Compare commits
No commits in common. "7ff3eb66f8010e1e3e804a6a4a27dce1b29e70f3" and "faa784b0ee49bfd3a1fa3bb97807e5a69f6e66ad" have entirely different histories.
7ff3eb66f8
...
faa784b0ee
@ -1,24 +0,0 @@
|
||||
usbdir='/home/belar/.scripts'
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $1 == 'attach' ]
|
||||
then
|
||||
virsh attach-device WinVM --file $usbdir/usb_lily58.xml --live
|
||||
virsh attach-device WinVM --file $usbdir/usb_logitech_g502.xml --live
|
||||
#virsh attach-device WinVM --file $usbdir/usb_scarlett_solo.xml --live
|
||||
#virsh attach-device WinVM --file $usbdir/usb_ax200_bluetooth.xml --live
|
||||
fi
|
||||
|
||||
if [ $1 == 'detach' ]
|
||||
then
|
||||
virsh detach-device WinVM --file $usbdir/usb_lily58.xml --live
|
||||
virsh detach-device WinVM --file $usbdir/usb_logitech_g502.xml --live
|
||||
#virsh detach-device WinVM --file $usbdir/usb_scarlett_solo.xml --live
|
||||
#virsh detach-device WinVM --file $usbdir/usb_ax200_bluetooth.xml --live
|
||||
fi
|
||||
|
@ -1,105 +0,0 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from bs4 import BeautifulSoup
|
||||
import asyncio
|
||||
import requests
|
||||
import os
|
||||
import time
|
||||
|
||||
|
||||
def scroll_and_scrape(driver, url):
|
||||
driver.get("https://www.newgrounds.com/")
|
||||
|
||||
print("Please login to your Newgrounds account and press enter to continue.")
|
||||
input()
|
||||
|
||||
driver.get(url)
|
||||
print("Scrolling down the page to load all the movies...")
|
||||
body = driver.find_element(By.CSS_SELECTOR, 'body')
|
||||
|
||||
for _ in range(30):
|
||||
body.send_keys(Keys.PAGE_DOWN)
|
||||
time.sleep(0.2)
|
||||
|
||||
page_content = driver.page_source
|
||||
return page_content
|
||||
|
||||
|
||||
def find_links(page_content, class_name):
|
||||
soup = BeautifulSoup(page_content, 'html.parser')
|
||||
links = soup.find_all('a', class_=class_name)
|
||||
for i in range(links.__len__()):
|
||||
print(i+1, links[i]['href'])
|
||||
return links
|
||||
|
||||
|
||||
def find_src(driver, link, class_name):
|
||||
driver.get(link)
|
||||
|
||||
video_element = driver.find_element(By.ID, class_name)
|
||||
if video_element is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
video_element.click()
|
||||
except:
|
||||
return None
|
||||
time.sleep(1)
|
||||
|
||||
soup = BeautifulSoup(driver.page_source, 'html.parser')
|
||||
links = soup.find_all('source', type='video/mp4')
|
||||
|
||||
if ("uploads" not in links[0]["src"]):
|
||||
return None
|
||||
|
||||
src = links[0]['src']
|
||||
|
||||
src = src.split('?')[0]
|
||||
return src
|
||||
|
||||
|
||||
async def download_video(location, url):
|
||||
name = url.split('/')[-1]
|
||||
response = requests.get(url)
|
||||
|
||||
with open(location + '/' + name, 'wb') as f:
|
||||
f.write(response.content)
|
||||
|
||||
|
||||
|
||||
|
||||
async def main():
|
||||
movies_url = 'https://derpixon.newgrounds.com/movies'
|
||||
|
||||
folder_name = movies_url.split('.')[0].replace('https://','')
|
||||
os.makedirs(folder_name, exist_ok=True)
|
||||
|
||||
driver = webdriver.Chrome()
|
||||
page_content = scroll_and_scrape(driver, movies_url)
|
||||
|
||||
print("Scraping movie links...")
|
||||
links = find_links(page_content, 'inline-card-portalsubmission')
|
||||
|
||||
|
||||
print("Scraping the video source & downloading the videos in background...\n")
|
||||
|
||||
dl_tasks = []
|
||||
for i in range(links.__len__()):
|
||||
time.sleep(3)
|
||||
print("\033[AVideo ", i+1, " of ", links.__len__())
|
||||
video_url = find_src(driver, links[i]['href'], 'ng-global-video-player')
|
||||
if video_url is not None:
|
||||
dl_tasks.append(asyncio.create_task(download_video(folder_name, video_url)))
|
||||
|
||||
driver.quit()
|
||||
print("Downloading ", dl_tasks.__len__, " videos...")
|
||||
await asyncio.gather(*dl_tasks)
|
||||
print("Done.")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
@ -1,5 +1,2 @@
|
||||
CURRENT_IP=$(curl -s https://api.ipify.org/)
|
||||
|
||||
echo $CURRENT_IP
|
||||
notify-send "Current IP" "$CURRENT_IP"
|
||||
|
||||
ip_value=$(curl -s https://api.ipify.org/)
|
||||
echo $ip_value
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
ssh_config = os.path.expanduser('~') + "/.ssh/config"
|
||||
@ -11,30 +10,22 @@ with open(ssh_config) as file:
|
||||
|
||||
#ping -c 1 -w 1
|
||||
|
||||
if sys.argv[1] != None:
|
||||
ssh_host = sys.argv[1]
|
||||
command = f"infocmp | ssh {ssh_host} 'tic -x /dev/stdin'"
|
||||
return_value = subprocess.call(command, shell=True, stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
|
||||
if return_value == 1:
|
||||
print(f"Could not send terminfo to {ssh_host}")
|
||||
for l in file_content:
|
||||
if "host " in l:
|
||||
l_index = file_content.index(l)
|
||||
index = l_index + 1
|
||||
host_ip = file_content[index].split()[1]
|
||||
|
||||
else:
|
||||
for l in file_content:
|
||||
if "host " in l:
|
||||
l_index = file_content.index(l)
|
||||
index = l_index + 1
|
||||
host_ip = file_content[index].split()[1]
|
||||
return_value = subprocess.call(["ping", "-c1", "-w1", host_ip], stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
|
||||
|
||||
return_value = subprocess.call(["ping", "-c1", "-w1", host_ip], stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
|
||||
if return_value == 0:
|
||||
ssh_host = l.split()[1]
|
||||
|
||||
if return_value == 0:
|
||||
ssh_host = l.split()[1]
|
||||
print(f"Host {ssh_host} ({host_ip}) is up. Sending terminfo..")
|
||||
|
||||
print(f"Host {ssh_host} ({host_ip}) is up. Sending terminfo..")
|
||||
command = f"infocmp | ssh {ssh_host} 'tic -x /dev/stdin'"
|
||||
|
||||
command = f"infocmp | ssh {ssh_host} 'tic -x /dev/stdin'"
|
||||
return_value = subprocess.call(command, shell=True, stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
|
||||
|
||||
return_value = subprocess.call(command, shell=True, stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
|
||||
|
||||
if return_value == 1:
|
||||
print(f"Could not send terminfo to {ssh_host}")
|
||||
if return_value == 1:
|
||||
print(f"Could not send terminfo to {ssh_host}")
|
||||
|
@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
STATE=$(mozillavpn status | grep "VPN state" | awk '{print $3}')
|
||||
|
||||
|
||||
if [ "$STATE" == "off" ]; then
|
||||
mozillavpn activate
|
||||
notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Activated"
|
||||
fi
|
||||
|
||||
if [ "$STATE" == "on" ]; then
|
||||
mozillavpn deactivate
|
||||
notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Deactivated"
|
||||
fi
|
@ -1,6 +0,0 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x8087"/>
|
||||
<product id="0x0029"/>
|
||||
</source>
|
||||
</hostdev>
|
@ -1,6 +0,0 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x04d8"/>
|
||||
<product id="0xeb2d"/>
|
||||
</source>
|
||||
</hostdev>
|
@ -1,6 +0,0 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x046d"/>
|
||||
<product id="0xc08b"/>
|
||||
</source>
|
||||
</hostdev>
|
@ -1,6 +0,0 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x1235"/>
|
||||
<product id="0x8211"/>
|
||||
</source>
|
||||
</hostdev>
|
Loading…
x
Reference in New Issue
Block a user