This file contains hidden or 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 | |
# To use do something like add this to your .gitconfig | |
# [alias] | |
# cp = "!$HOME/.local/bin/git-cp.sh" | |
# | |
# Then you can do things like | |
# $ git cp sha1:/path/to/old/file /tmp | |
set -e |
This file contains hidden or 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/python3 | |
import appdirs, toml | |
import logging, tempfile | |
import os, sys | |
import select | |
import math | |
import re | |
import shutil |
This file contains hidden or 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
function wtf { | |
local -a files | |
while IFS= read -r i; do | |
files+=("$i") | |
done | |
local width=$(( ( $(tput cols) * 4 ) / 5)) | |
local head=$(( width / 2 )) | |
local question="$1" | |
local each_question |
This file contains hidden or 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 | |
tool=./vast.py | |
tmp=$(mktemp -d --suffix .vastai) | |
tmp_host=$(basename $tmp) | |
instance=$1 | |
_start=${2:-11000} | |
read -r port ip <<EOF | |
$($tool show instance $instance --raw | jq -r '.ports["22/tcp"][0].HostPort,.public_ipaddr' | tr '\n' ' ' ) | |
EOF | |
ssh_url="ssh://root@$ip:$port" |
This file contains hidden or 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 python | |
# | |
# Due to the design of the sdk, pylint has a false | |
# positive for the functions. | |
# | |
# pylint: disable=assignment-from-no-return | |
import csv | |
import json | |
import math |
This file contains hidden or 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
ssh() { | |
local _ssh="/usr/bin/ssh" | |
local n="" | |
[[ "$*" =~ \/ ]] || { $_ssh $*; return } | |
echo "$*" | tr "/" " " | rev | while read -d' ' i; do | |
i=$(echo "$i" | rev) | |
[[ -n "$n" ]] && n="\"$n"\" | |
n="$_ssh $i $n" | |
done | |
i=$(echo "$i" | rev) |
This file contains hidden or 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/python3 | |
import math | |
import numpy as np | |
for roi in np.arange(1.01, 1.07, 0.01): | |
monthly = math.log(roi)/12 | |
rent = 1000 | |
ttl = 0 | |
# "From March 2020 - Sept 2021 is due by Aug 2023" |
This file contains hidden or 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 | |
# nmap -sn subnet > scan | |
netmask=255.255.254.0 | |
gw=172.19.248.1 | |
cat > try.awk << ENDL | |
{ | |
switch(NR % 3) { | |
case 0: | |
mac=\$3 |
This file contains hidden or 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
#include <TM1637.h> | |
// | |
// This is just some mish-mash of a bunch of things but it's posted for the video over here: | |
// https://youtu.be/JN4j-aCagH0 | |
// | |
// How you set the date: | |
// exec 3<> /dev/ttyUSB0 | |
// printf "$(date "+obase=16;4096+(%H*60+%M)" | bc | sed -E s'/(..)/\\x\1/g')" > /dev/ttyUSB0 | |
// exec 3<&- |
This file contains hidden or 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/python3 | |
import pyemvue as pyem, json, sys | |
with open('keys.json') as f: | |
data = json.load(f) | |
v = pyem.PyEmVue() | |
v.login(id_token=data['id_token'], | |
access_token=data['access_token'], | |
refresh_token=data['refresh_token'], | |
token_storage_file='keys.json') |
NewerOlder