This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
from selenium import webdriver | |
from PIL import Image | |
from io import BytesIO | |
url = "https://unsplash.com" | |
driver = webdriver.Firefox(executable_path=r'geckodriver.exe') | |
driver.get(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Websockets client for micropython | |
Based very heavily on | |
https://github.com/aaugustin/websockets/blob/master/websockets/client.py | |
""" | |
import ubinascii as binascii | |
import urandom as random | |
import ure as re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import pathlib | |
def common_prefix(*paths): | |
"""Common prefix of given paths""" | |
counter = collections.Counter() | |
for path in paths: | |
assert isinstance(path, pathlib.Path) | |
counter.update([path]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wavfile.py (Enhanced) | |
# Date: 20190213_2328 Joseph Ernest | |
# | |
# URL: https://gist.github.com/josephernest/3f22c5ed5dabf1815f16efa8fa53d476 | |
# Source: scipy/io/wavfile.py | |
# | |
# Added: | |
# * read: also returns bitrate, cue markers + cue marker labels (sorted), loops, pitch | |
# See https://web.archive.org/web/20141226210234/http://www.sonicspot.com/guide/wavefiles.html#labl | |
# * read: 24 bit & 32 bit IEEE files support (inspired from wavio_weckesser.py from Warren Weckesser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// wavecuepoint.c | |
// Created by Jim McGowan on 29/11/12. | |
// Turned into command-line utility by David Hilowitz on 19/11/16. | |
// jim@bleepsandpops.com | |
// jim@malkinware.com | |
// | |
// This function reads a .wav file and a text file containing marker locations (specified as frame indexes, one per line) | |
// and creates a new .wav file with embedded cue points for each location. The code is standard, portable C. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: list | |
lv2_class: lv2_class.c | |
gcc -std=gnu99 -O3 -o $@ $< $(shell pkg-config --cflags --libs lilv-0) | |
list: lv2_class | |
./$< \ | |
| sort \ | |
| sed 's/,/\n/g' \ | |
| zenity \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple, OrderedDict | |
from functools import partial | |
# important: pass (name, value) pairs as a tuple/sequence not as keyword args! | |
# otherwise, order will not be preserved. | |
fields = OrderedDict((('foo', "bar"), ('spamm', "eggs"), ('ham', None))) | |
T = partial(namedtuple("T", fields), **fields) | |
t1 = T() | |
print(t1) | |
t2 = T(ham="bacon") |
Execstack is a great tool for learning and training on Linux. It is a program which sets, clears, or queries the executable stack flag of ELF binaries and shared libraries. When I was looking to install it I took me a bit to find which package to install it in.
You can install with :
Ubuntu
$ sudo apt-get install prelink
Arch Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
random_wallpaper="$(find $1 -maxdepth 1 -name *.png | shuf | head -1)" | |
actual_size="$(identify -format %wx%h $random_wallpaper)" | |
target_size=$(xrandr | head -n 1 | awk -e '{OFS=""; gsub("[ ,]+","",$10); print $8,"x",$10;}') | |
if [[ "$actual_size" != "$target_size" ]]; then | |
convert "$random_wallpaper" -background black -gravity center -scale $target_size -extent $target_size png:- | i3lock -i /proc/self/fd/0 | |
else | |
i3lock -t -i "$random_wallpaper" | |
fi |