Skip to content

Instantly share code, notes, and snippets.

View sam0x17's full-sized avatar

Sam Johnson sam0x17

View GitHub Profile
@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 / 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 / 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 / ps1.sh
Last active November 8, 2018 03:58
my ps1
export PS1="\[\e[34m\]\W\[\e[m\]\\$ "
@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);
#[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 / 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.

@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 / settings.json
Created August 20, 2019 00:54
vscode multi-language indententation settings
"editor.tabSize": 2,
"editor.detectIndentation": true,
"[rust]": {
"editor.detectIndentation": true,
"editor.tabSize": 4
},
"[python]": {
"editor.detectIndentation": true,
"editor.tabSize": 4
}
@sam0x17
sam0x17 / ruby_fix.md
Created November 13, 2019 01:36
fix for installing ruby 2.5.x via RVM on macos

Error:

ossl_x509crl.cossl_x509cert.c:334:59: error: member reference type 'int' is not a pointer

Fix:

rvm install 2.5.7 --with-openssl-dir=`brew --prefix openssl`