Skip to content

Instantly share code, notes, and snippets.

@timothyklim
timothyklim / fpmax.scala
Created November 4, 2018 14:35 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@timothyklim
timothyklim / config.md
Created September 7, 2018 16:46 — forked from 0XDE57/config.md
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@timothyklim
timothyklim / ph_measure.c
Last active June 3, 2018 20:42
Arduino pH sensor
double ph1 = 4.01;
double ph2 = 6.86;
double r1 = 2.925; // pH 1 voltage
double r2 = 2.314; // pH 2 voltage
double delta = (ph2 - ph1) / (r2 - r1);
double calibration = ph1 - delta * r1;
const int PoPin = A0;
@timothyklim
timothyklim / debian-strongswan.md
Created April 25, 2018 09:58 — forked from andrewlkho/debian-strongswan.md
Setting up a secure VPN with strongSwan on debian

With heightening concern regarding the state of internet privacy (fuelled in part by the passing of the Investigatory Powers Act in the UK), I have set up a VPN server on the virtual server I have hosted with Mythic Beasts. This uses strongSwan and certificate-based IKEv2 authentication.

Assumptions:

  • Debian Jessie server already set up and accessible via debian.example.com, a public IPv4 of 203.0.113.1 and a public IPv6 of 2001:db8::1
  • Client username of me
  • Clients are running the latest versions of macOS and iOS (Sierra and 10 respectively at the time of writing)
  • No need to support any other operating systems (although the setup is easily translated)

For automated deployment of a similar setup, albeit Ubuntu-based and using ansible for deployment, I recommend you take a look at Algo VPN. I used that project as a basis for my configuration.

http://tatiyants.com/pev/#/plans
psql -qAt -f explain.sql > analyze.json
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) SELECT ...
@timothyklim
timothyklim / zram.sh
Created January 27, 2018 01:18 — forked from sultanqasim/zram.sh
ZRAM config for Raspberry Pi 3
#!/bin/bash
# Raspberry Pi ZRAM script
# Tuned for quad core, 1 GB RAM models
# put me in /etc/init.d/zram.sh and make me executable
# then run "sudo update-rc.d zram.sh defaults"
modprobe zram
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm
@timothyklim
timothyklim / about:config.md
Created January 12, 2018 23:46 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

NOTE: Unfortunately this is somewhat out of date. The comments link to some resources that may be more up-to-date. Patches welcome.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.

@timothyklim
timothyklim / qemu_osx_rpi_raspbian_jessie.sh
Created November 30, 2017 18:03 — forked from hfreire/qemu_osx_rpi_raspbian_jessie.sh
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@timothyklim
timothyklim / reactive_systems_bibliography.md
Created November 21, 2017 18:11 — forked from brendanzab/reactive_systems_bibliography.md
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books

@timothyklim
timothyklim / .ghci
Created September 11, 2017 07:49 — forked from 3noch/.ghci
Reflex-DOM Auto Reload Development with ghcid
:set prompt "> "
:set -isrc
:load Main