Skip to content

Instantly share code, notes, and snippets.

View dsewnr's full-sized avatar
⛰️
LNT

Peter Lu dsewnr

⛰️
LNT
View GitHub Profile
@dsewnr
dsewnr / gnupg_scdaemon.md
Created November 6, 2021 15:39 — forked from artizirk/gnupg_scdaemon.md
OpenPGP SSH access with Yubikey and GnuPG

OpenPGP SSH access with Yubikey and GnuPG

Yubikey, Smart Cards, OpenSC and GnuPG are pain in the ass to get working. Those snippets here sould help alleviate pain.

Yubikey Config under Ubuntu

To reset and disable not used modes on Yubikey you need the ykman program

You can install it using those commands

@dsewnr
dsewnr / ecr-cred-updater.sh
Created July 22, 2021 06:46 — forked from cablespaghetti/ecr-cred-updater.sh
Automatic Updating Amazon ECR Credentials in Kubernetes
#!/bin/bash
# Get directory of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $# -ne 1 ]]
then
echo "ERROR: This script expects the namespace name to be given as an argument"
echo "e.g. ./ecr-cred-updater.sh my-namespace"
exit 1
@dsewnr
dsewnr / init.vim
Created June 1, 2021 16:02
Neovim rc file
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" On-demand loading
Plug 'KeitaNakamura/neodark.vim'
let g:neodark#background = '#202020'
" let g:neodark#use_256color = 1
Plug 'ryanoasis/vim-devicons'

Keybase proof

I hereby claim:

  • I am dsewnr on github.
  • I am dsewnr (https://keybase.io/dsewnr) on keybase.
  • I have a public key whose fingerprint is 9959 7643 7C7E 532B 837C 06A3 7B00 DE06 31B5 FDA9

To claim this, I am signing this object:

" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'mhinz/vim-startify'
Plug 'tpope/vim-obsession'
@dsewnr
dsewnr / TrueColour.md
Created August 1, 2019 03:24 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@dsewnr
dsewnr / docker-compose.yml
Last active January 19, 2019 16:18
docker-compose.yml for NSQ
# DON'T FORGET TO ADD "127.0.0.1 nsqd" TO /etc/hosts
version: '3'
services:
nsqlookupd:
image: nsqio/nsq
networks:
- nsq-network
hostname: nsqlookupd
ports:
@dsewnr
dsewnr / localStorage.js
Created June 5, 2018 05:04 — forked from anhang/localStorage.js
HTML5 Local Storage with Expiration
AZHU.storage = {
save : function(key, jsonData, expirationMin){
if (!Modernizr.localstorage){return false;}
var expirationMS = expirationMin * 60 * 1000;
var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS}
localStorage.setItem(key, JSON.stringify(record));
return jsonData;
},
load : function(key){
if (!Modernizr.localstorage){return false;}
@dsewnr
dsewnr / ctrl_touchpad.sh
Last active May 2, 2018 06:25
Script To Enable/Disable TouchPad for Thinkpad X1 Carbon 5th Gen
#!/bin/bash
# ./ctrl_touchpad.sh (enable|disable)
xinput $1 $(xinput | grep TouchPad | cut -d '=' -f 2 | awk '{print $1}')
@dsewnr
dsewnr / speedup_trackpoint.sh
Last active May 2, 2018 06:25
Script to Speed Up TrackPoint for Thinkpad X1 Carbon 5th Gen
#!/bin/bash
# obtain TrackPoint ID from xinput list
TP_ID=$(xinput list | grep TrackPoint | cut -f 2 | grep -Eo '[0-9]{1,}')
if [ -n "$TP_ID" ]; then
# obtain properties from xinput list-props "$TP_ID"
AS_ID=$(xinput list-props "$TP_ID" | grep 'libinput Accel Speed (' | cut -f 2 | grep -Eo '[0-9]{1,}')
# set the speed you want
xinput set-prop "$TP_ID" "$AS_ID" 1