Skip to content

Instantly share code, notes, and snippets.

View patcito's full-sized avatar

Patrick Aljord patcito

View GitHub Profile
@vincentriemer
vincentriemer / twitter_encode.sh
Created May 5, 2019 02:08
Script to encode videos optimized for Twitter with ffmpeg. NOTE: Read through the entire script before running and modify to your needs, as it is currently configured for my own environment
#!/usr/bin/env bash
set -e
# usage:
# $ ./encode.sh [INPUT_FILE]
#
# NOTE: The output directory is defined in the script (below) because I use this script with Hazel
# START CONFIGURATION ==================
@bricewge
bricewge / Caddyfile
Created February 23, 2019 10:41
Deploying hugo blog with caddy
localhost:8080 {
root ./my-site
internal .repo
git {
repo https://github.com/kaushalmodi/hugo-bare-min-theme.git
path .repo
clone_args --depth 1 --recurse-submodules
pull_args --recurse-submodules
interval 3600
then hugo --source ./exampleSite --destination ../..
@rkennesson
rkennesson / hyperfido.txt
Created March 19, 2017 05:08
Hyperfido instructions
HyperFido - FIDO U2F Security Key
By Jonathan Williams
https://www.amazon.com/review/R1MX4254RVC97T/ref=cm_cr_dp_cmt?ie=UTF8&ASIN=B00WIX4JMC&channel=detail-glance&nodeID=541966&store=pc#wasThisHelpful
This HyperFIDO U2F key is small enough to keep in your pocket or purse at all times and never worry about it. It worked great after getting a fast reply from HyperSECU support about the linux udev rules needed (I don't use windows). I had it set up very quickly with Google services and it worked flawlessly. Hopefully, more services will support U2F in the future.
If you are wondering, here are the udev rules their awesome support recommended. I created a file /etc/udev/rules.d/96-hyperfido.rules and used the first example below because thankfully, I do not have to deal with systemd. If you are unfortunate enough to have to use systemd, please use the second example.
Example 1
@erikcw
erikcw / nginx.conf
Last active August 22, 2023 10:58
Simple nginx lua script to add UUID to each request for end to end request tracking.
# Dependencies
# nginx_lua
# lua uuid module (luarocks install uuid)
http {
# this will be the request id
map $host $request_uuid {
default '';
}
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab "expandtab (whitespace)
set number "line numbers
set ai "autoindent
set si "smartindent
set tw=79 "wrap on 79
set sta "smarttab
set history=100 "remember more than 20 cmd-history
@nictuku
nictuku / sshd.go
Created April 8, 2012 15:43
Go SSH server complete example
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@iwinux
iwinux / gist:1529093
Created December 28, 2011 18:38
config.assets.precompile
def compile_asset?(path)
# ignores any filename that begins with '_' (e.g. sass partials)
# all other css/js/sass/image files are processed
if File.basename(path) =~ /^[^_].*\.\w+$/
puts "Compiling: #{path}"
true
else
puts "Ignoring: #{path}"
false
end