Compare commits
7 Commits
faa784b0ee
...
7ff3eb66f8
Author | SHA1 | Date | |
---|---|---|---|
7ff3eb66f8 | |||
e83df654fa | |||
e1480fa3b2 | |||
ad05e7ad64 | |||
c9c39aab7b | |||
f3d27cc386 | |||
cdc4dfa13b |
24
WinVM_hotplug_usb.sh
Executable file
24
WinVM_hotplug_usb.sh
Executable file
@ -0,0 +1,24 @@
|
||||
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
|
||||
|
105
newgrounds-movie-scrapper.py
Executable file
105
newgrounds-movie-scrapper.py
Executable file
@ -0,0 +1,105 @@
|
||||
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,2 +1,5 @@
|
||||
ip_value=$(curl -s https://api.ipify.org/)
|
||||
echo $ip_value
|
||||
CURRENT_IP=$(curl -s https://api.ipify.org/)
|
||||
|
||||
echo $CURRENT_IP
|
||||
notify-send "Current IP" "$CURRENT_IP"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
ssh_config = os.path.expanduser('~') + "/.ssh/config"
|
||||
@ -10,6 +11,14 @@ 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}")
|
||||
|
||||
else:
|
||||
for l in file_content:
|
||||
if "host " in l:
|
||||
l_index = file_content.index(l)
|
||||
|
3
stream.sh
Executable file
3
stream.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
yt-dlp $1 -o - --downloader native -f best | mpv -
|
14
toggle-mozvpn.sh
Normal file
14
toggle-mozvpn.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/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
|
6
usb_ax200_bluetooth.xml
Normal file
6
usb_ax200_bluetooth.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x8087"/>
|
||||
<product id="0x0029"/>
|
||||
</source>
|
||||
</hostdev>
|
6
usb_lily58.xml
Normal file
6
usb_lily58.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x04d8"/>
|
||||
<product id="0xeb2d"/>
|
||||
</source>
|
||||
</hostdev>
|
6
usb_logitech_g502.xml
Normal file
6
usb_logitech_g502.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x046d"/>
|
||||
<product id="0xc08b"/>
|
||||
</source>
|
||||
</hostdev>
|
6
usb_scarlett_solo.xml
Normal file
6
usb_scarlett_solo.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<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