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 os | |
import random | |
import sqlite3 | |
import sys | |
import uuid | |
from flask import (Flask, redirect, render_template_string, request, | |
send_from_directory) | |
IMAGES_DIR = "images" |
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
#!/usr/bin/env python3 | |
# usage: eval `./runner.py VID_20200321_142302.mp4 Recording_9.m4a 0 00:01:40.76 45.2 p3oc.mp4 s3.srt` | |
import sys | |
import os | |
import tempfile | |
if len(sys.argv) not in [7, 8]: | |
print("runner has to run with `runner <video> <audio> <start> <end> <audio_trim> <output> [<subtitle file>]`") |
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
#2019 | |
def labor2(x): | |
if x <= 9694: | |
return 0.01754 * x | |
elif x <= 34060: | |
return min(3399.0, 0.01754 * 9694 + 0.28712 * (x - 9694)) | |
elif x <= 90710: | |
return 3399.0 - 0.06 * (x - 34060) | |
else: |
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 | |
MAC='0C:62:A6:13:4A:8A' | |
IP='192.168.178.13' | |
[ "$#" == 0 ] && echo 'missing argument, can be one of on, off, toggle' >&2 && exit 1 | |
on () { | |
echo "turning on" | |
python "$HOME"/.bin/wowlan.py $MAC |
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
<!DOCTYPE html> | |
<html> | |
<!-- | |
usage: | |
1. install jq for json parsing. | |
2. go here https://takeout.google.com/settings/takeout and download "Location history" in json format and save it as location.json. | |
3. run `cat location.json|jq '.locations | map(select(has("accuracy"))) | map({lat: (.latitudeE7 / 10000000), lng: (.longitudeE7 / 10000000), accuracy: .accuracy, timestamp: (.timestampMs | tonumber / 1000)})' > google.json` | |
4. cp google.json google.js. | |
5. add `var points = ` to the beginning of google.js file `sed -i '1s/^/var points = /' google.js`. |
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 | |
export COLOR_NC='\e[0m' | |
export COLOR_GREEN='\e[0;32m' | |
export COLOR_RED='\e[0;31m' | |
export INTERFACE='wlp3s0' | |
if [ "`nmcli networking`" == "enabled" ]; then | |
printf "${COLOR_GREEN}networking enabled${COLOR_NC}\n" | |
else |
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 | |
# Usage: ./my-service --listen=127.0.0.1:`mon 8080` | |
PORT=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 )) | |
echo "$PORT" | |
socat -v TCP4-LISTEN:"$1",bind=127.0.0.1,reuseaddr,fork TCP4:"${2:-127.0.0.1}":$PORT >&2 & ! |
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
package main | |
import ( | |
"crypto/salsa20" | |
"crypto/sha512" | |
"encoding/binary" | |
"unsafe" | |
) | |
const ( |
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
#!/usr/bin/env python3 | |
import sys | |
import os | |
import subprocess | |
from time import sleep | |
import threading | |
import time | |
HOME = os.environ['HOME'] | |
CACHE = '{}/.cache/vlcwrapper'.format(HOME) |
NewerOlder