Skip to content

Instantly share code, notes, and snippets.

View sam0x17's full-sized avatar

Sam Johnson sam0x17

View GitHub Profile
@sam0x17
sam0x17 / docker.sh
Last active August 4, 2019 23:45
local docker environment setup
# set up docker volume and image (host ~ will be bound to /host)
docker volume create devenv
mkdir -p ~/.alpine-dev
docker run -v ~:/host -it --mount source=devenv,target=/Users/sam/.alpine-dev --name alpine-dev alpine
# setup within container:
apk add bash
ln -fs /bin/bash /bin/sh
adduser sam
apk add sudo
@sam0x17
sam0x17 / fix.md
Created May 5, 2019 05:23
fix for firefox gtk3 (linux) dark mode theme issue

A partial fix is to add new string key to about:config with "widget.content.gtk-theme-override" name and "Adwaita:light" value.

#[cfg(test)]
use std::fmt::Debug;
#[cfg(test)]
use std::cmp::PartialEq;
#[cfg(test)]
pub fn assert_iter_eq<T: Iterator, U: ExactSizeIterator>(a: T, b: U)
where
T: ExactSizeIterator,
<T as Iterator>::Item: Debug + PartialEq,
@sam0x17
sam0x17 / viewportheight.md
Last active January 25, 2019 06:28
True mobile viewport height

mobile browsers these days have annoying address bars / toolbars / etc that interfere with the viewport height, so if you have some 100vh elements they get partially obscured... to get the TRUE height of the viewport use:

Math.min(document.documentElement.clientHeight, window.screen.height, window.innerHeight);
@sam0x17
sam0x17 / gcf.cr
Last active November 3, 2018 19:02
require "gcf"
class Example < GCF::CloudFunction
def run(params : JSON::Any)
# your code here
end
end
@sam0x17
sam0x17 / disable hotcorner
Created May 2, 2018 05:11
disable gnome activities top left hot corner
install gnome extension: https://extensions.gnome.org/extension/118/no-topleft-hot-corner/
@sam0x17
sam0x17 / trackpoint.sh
Created April 28, 2018 21:06
set trackpoint sensitivity linux
#!/bin/bash
# must be run with sudo, tested with Lenovo X270 on Ubunto 16.04 and 17.10
echo "setting trackpoint speed and sensitivity"
set -o noclobber
echo "110" >| /sys/devices/platform/i8042/serio1/serio2/speed
echo "200" >| /sys/devices/platform/i8042/serio1/serio2/sensitivity
exit 0
@sam0x17
sam0x17 / ps1.sh
Last active November 8, 2018 03:58
my ps1
export PS1="\[\e[34m\]\W\[\e[m\]\\$ "
@sam0x17
sam0x17 / cac.sh
Last active March 21, 2018 15:57
Ubuntu CAC Setup
#!/bin/bash
sudo apt-get update
sudo apt-get install -y libpcsclite1 coolkey pcsc-tools libpcsc-perl libccid pcscd libnss3-tools
sudo service pcscd start
curl http://militarycac.com/maccerts/AllCerts.zip > ~/DOD_Certs.zip
modutil -dbdir sql:/home/`whoami`/.pki/nssdb/ -add "CAC Module" -libfile /usr/lib/pkcs11/libcoolkeypk11.so
# Configure touchpads to use xf86-input-synaptics X input driver
Section "InputClass"
Identifier "touchpad"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "synaptics"
Option "MinSpeed" "0.4"
Option "MaxSpeed" "1.0"
Option "AccelFactor" "0.0035"