Skip to content

Instantly share code, notes, and snippets.

View ukscone's full-sized avatar
💭
🐛🐛🐛🐛🐛🐛🐛🐛

Russell Davis ukscone

💭
🐛🐛🐛🐛🐛🐛🐛🐛
View GitHub Profile
@ukscone
ukscone / resize
Created September 18, 2023 03:46
set new terminal size
rsz() {
if [[ -t 0 && $# -eq 0 ]];then
local IFS='[;' escape geometry x y
echo -ne '\e7\e[r\e[999;999H\e[6n\e8'
read -t 5 -sd R escape geometry || {
echo unsupported terminal emulator. >&2
return 1
}
x="${geometry##*;}" y="${geometry%%;*}"
if [[ ${COLUMNS} -eq "${x}" && ${LINES} -eq "${y}" ]];then
@ukscone
ukscone / readme.txt
Last active May 4, 2022 22:45
Build solo2 cli on debian based OS -- confirmed raspberrypi os
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo apt install pkg-config build-essential
sudo apt-get install libudev-dev libudev1 libudev0
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0
sudo apt-get install libpcsclite1 libpcsclite-dev
sudo apt-get install pcscd pcsc-tools
sudo nano /etc/udev/70-solo2.rules
---
# NXP LPC55 ROM bootloader (unmodified)
@ukscone
ukscone / doch
Created October 17, 2020 16:34
doch
csh: alias doch sudo \!-1 bash: alias doch='sudo $(history -p !-1)' zsh: alias doch='sudo $(fc -ln -1)'
@ukscone
ukscone / mixjack.py
Created March 3, 2020 22:44
hacky mixjuice/micjack "emulator" for raspberry pi/pc
import requests
import serial
from functools import partial
from time import sleep
ser = serial.Serial('/dev/ttyUSB0',115200)
def version():
return "'MixJack (Python) Version 0.0.1\n"
@ukscone
ukscone / tmux-connect
Created December 16, 2019 18:51
tmux-connect
function tmux-connect {
TERM=xterm-256color ssh -p ${3:-22} $1@$2 -v -t "tmux new-session -s $1 || tmux attach-session -t $1"
}
@ukscone
ukscone / gist:6dbf301b787da4f90f690e1e347b5da9
Created October 2, 2018 03:35 — forked from andrewlkho/gist:e9a8c996c4bc1df23cd2
How to secure debian with two factor authentication (TOTP/HOTP)

First, install the necesssary packages:

% apt-get install libpam-oath oathtool

Generate a key and write it to /etc/users.oath (NB the key will be in hexadecimal; if you are using Authy you will want to convert it to BASE32):

% KEY=$( head -c 1024 /dev/urandom | openssl sha1 | awk '{ print $2 }' )
% echo "HOTP/T30/6 andrewlkho - ${KEY}" >> /etc/security/users.oath
% chmod 600 /etc/users.oath
@ukscone
ukscone / vtb.sh
Last active September 25, 2019 22:37
vtb
#!/bin/bash
#Don't forget to mod line 40 in Flu_DND.cpp from objUnderMouse = false; to objUnderMouse = (void *)false;
wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-source.tar.gz
tar xzvf fltk-1.3.4-source.tar.gz
cd fltk-1.3.4
./configure --enable-localjpeg --enable-localzlib --enable-localpng --enable-gl=no
make
cd ..
fltkdir=$PWD/fltk-1.3.4/
cvs -z3 -d:pserver:anonymous@virtualt.cvs.sourceforge.net:/cvsroot/virtualt co -P VirtualT
@ukscone
ukscone / readme.md
Last active July 28, 2018 01:39
Using Chromebrew when you have an irrational fear of wearing out emmc/ssd's
  1. partition usb drive using preferred linux partitioning tool

  2. formst a partition as ext4

sudo mkfs.ext4 /dev/sdb1 -L usb3drive

  1. install chromebrew as per instructions in the chromebrew repo

curl -Ls git.io/vddgY | bash

@ukscone
ukscone / reflect.py
Created April 28, 2018 00:03 — forked from 1kastner/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@ukscone
ukscone / java_String_hashcode.py
Created April 26, 2018 02:44 — forked from hanleybrand/java_String_hashcode.py
python function that produces the same result as java's String.hashCode() found at http://garage.pimentech.net/libcommonPython_src_python_libcommon_javastringhashcode/
def java_string_hashcode(s):
h = 0
for c in s:
h = (31 * h + ord(c)) & 0xFFFFFFFF
return ((h + 0x80000000) & 0xFFFFFFFF) - 0x80000000