Skip to content

Instantly share code, notes, and snippets.

View fionn's full-sized avatar
🦜
wars are waged by technicians

Fionn Fitzmaurice fionn

🦜
wars are waged by technicians
View GitHub Profile

Keybase proof

I hereby claim:

  • I am iamfionn on github.
  • I am fionn (https://keybase.io/fionn) on keybase.
  • I have a public key whose fingerprint is BE71 49DD 3EEA 15D8 CD5B D7F6 18E5 CC17 7837 7A29

To claim this, I am signing this object:

#!/bin/bash
if [ "$1" == "" ]; then
echo "You have to give me a file"
exit 1
fi
file=$1
printer="192.168.10.200"
port="9100"
@fionn
fionn / tunnel.sh
Last active September 18, 2021 15:29
Cheap SOCKS proxy using an SSH tunnel.
#!/bin/bash
# Launch SSH tunnel for SOCKS proxy.
set -euo pipefail
host="$1"
local_port=1080
control_dir="$(dirname "$(mktemp -u)")"
control_path="$control_dir/ssh-control-%r@%h:%p"
@fionn
fionn / mc.cpp
Created February 19, 2017 22:21
Calculate π using Monte Carlo
#include <iostream>
using namespace std;
int main()
{
double x, y;
double N = 100000;
int c = 0;
@fionn
fionn / Riemann.cpp
Last active March 28, 2017 18:21
Calculate the Riemann sum of 1 + e^x for 0 < x < 1.
#include <iostream>
#include <cmath>
using namespace std;
double f(double x)
{
return 1 + exp(x);
}
@fionn
fionn / wpa.sh
Created March 28, 2017 18:23
make drone's WPA configuration persistent
#!/bin/sh
# Append
# /home/default/wpa.sh &
# to /bin/wifi_setup.sh
# The desired IP address for the drone
ADDRESS="192.168.x.y"
# WPA credentials for the new network
@fionn
fionn / fix.sh
Created May 22, 2017 22:38
Fixes weird problem with old Android phone where it disables WiFi networks
#!/system/bin/sh
sed -i.bak '/\tdisabled=1/d' /data/misc/wifi/wpa_supplicant.conf
exit 0
@fionn
fionn / dsinc.cpp
Created May 22, 2017 22:46
Comparison of derivatives of the sinc function
#include <iostream>
#include <cmath>
using namespace std;
double f(double x)
{
if(x == 0)
return 1;
return sin(x) / x;
@fionn
fionn / gif.sh
Last active June 19, 2022 11:38
Make gifs from videos
#!/bin/bash
set -euo pipefail
if [ ! "$1" ]; then
echo "Usage: $0 start_time duration input"
exit 1
fi
start_time=$1
# Execute pairing program when appropriate
ACTION=="add|remove", SUBSYSTEM=="net", ATTR{idVendor}=="18d1" ENV{ID_USB_DRIVER}=="rndis_host", SYMLINK+="android", RUN+="/usr/bin/systemctl restart systemd-networkd.service"