Skip to content

Instantly share code, notes, and snippets.

View oskarsh's full-sized avatar
🐢
interested in life and other forms of art

oskar oskarsh

🐢
interested in life and other forms of art
View GitHub Profile
import requests
#specify the api of coinmarketcap
url = https://api.coinmarketcap.com/v1/ticker/?convert=EUR&Limit=10
# for every coin we find on the website
for coin in requests.get(url).json():
print(coin['name], coin['price_usd’])
@oskarsh
oskarsh / coincrawler-beautiful.py
Created June 19, 2018 09:48
This will work like the coincrawler in a more general way using the BeautifulSoup module.
import urllib.parse
import urllib.request
from bs4 import BeautifulSoup
from pprint import pprint
def urlReader(url):
print("")
print("fetching data from coinmarketcap.com")
req = urllib.request.Request(url)
resp = urllib.request.urlopen(req)
dbus-send --session --dest=org.kde.plasmashell --type=method_call /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:
var Desktops = desktops();
for (i=0;i<Desktops.length;i++) {
d = Desktops[0];
d.wallpaperPlugin = "org.kde.image";
d.currentConfigGroup = Array("Wallpaper",
"org.kde.image",
"General");
d.writeConfig("Image", "file:'$1'");
}'
#sudo vi /etc/udev/rules.d/90-xhc_sleep.rules
# disable wake from S3 on XHC1
SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"
@oskarsh
oskarsh / get_ssh_output.py
Last active April 26, 2019 19:01
[run commands on ssh machine] runs a command on a device connected with ssh and gets output
#definde ssh
ssh_connection="root@189.232.123.XX"
password="admin"
sshpass -p $password ssh $ssh_connection #":command here:"
#ls command
ssh_connection="root@189.232.123.XX"
password="admin"
command="ls"
@oskarsh
oskarsh / check_if_file_exists.sh
Created April 27, 2019 12:15
Checks a directory if a file exists
find $directory_path -name $file_name | wc -l
@oskarsh
oskarsh / colorized_print.sh
Created April 27, 2019 15:41
[colorize terminal output]
# Colourise the output
YEL='\033[1;33m' # Yellow
NCL='\033[0m' # No Color
RED='\033[0;31m' # REDs
printf "%*s\WITH THE NAME:\t${YEL}%s${NCL}\n" $((indent+4)) '' "$name.mp3"
@oskarsh
oskarsh / folder_file_infos.py
Created May 8, 2019 21:07
[getting each file inside a folder with extension]
index = [y for x in os.walk(base_path) for y in glob(os.path.join(x[0], '*.jpg'))]
@oskarsh
oskarsh / setup.sh
Last active November 21, 2019 06:25
Setup Solus for Development
sudo eopkg upgrade
sudo eopkg install docker zsh docker-compose vscode nodejs
sudo eopkg install -c system.devel
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker daeh
@oskarsh
oskarsh / HiseSliderMod.js
Created October 27, 2022 13:51
Adds a easily moddable vector slider for hise.
const laf = Engine.createGlobalScriptLookAndFeel();
const BORDER = 3;
const PADDING = 10;
const GLOW_RING_SIZE = 3;
const GLOW_AMOUNT = 3;
const BLACK = '0x000000';
const RED_COLOUR = '0xFBFF0000';
const BLUE_COLOUR = '0xFB0023FF';
const BORDER_COLOR = '0xDFDFDF';