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 / 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;
# 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"
@fionn
fionn / repeat.sh
Created August 22, 2017 15:17
Repeat a Python program until it fails
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Requires 1 argument; $# given"
exit 1
fi
while true; do
python $1
if [[ $? -ne 0 ]]; then
@fionn
fionn / add_credentials.sh
Last active November 4, 2017 07:23
Add a credential file to OpenVPN configurations
#/bin/bash
if [ $(id -u) != 0 ]; then
echo "You must be root"
sudo "$0" "$@"
exit $?
fi
for file in $@; do
sed -i "s|^auth-user-pass$|& /etc/openvpn/client/provider/secret.password|" $file