Skip to content

Instantly share code, notes, and snippets.

View faun's full-sized avatar
🌵

Faun faun

🌵
View GitHub Profile
@faun
faun / generate_yubikey_keys.sh
Last active September 1, 2021 11:31
Configure Yubikey and generate PKCS #11 keys
echo "Setting the YubiKey to be a U2F device and behave as a smart card"
ykpersonalize -m 86
if [[ $# -eq 1 ]] && [[ "$1" = "first-run" ]]
then
echo "Please set a new managment key:"
yubico-piv-tool -aset-mgm-key || true
echo "Please set the device PIN:"
yubico-piv-tool -achange-pin -P123456
@faun
faun / open_pull_request.sh
Created June 29, 2017 16:37
Open a given pull request in the browser. Depends on hub and fzf
hub browse -- pull/$(hub issue --include-pulls | fzf | awk '{print $1}' | sed -e 's/^#//')
@faun
faun / Github Flavored Markdown.md
Created September 14, 2016 18:10 — forked from stevenyap/Github Flavored Markdown.md
Github Flavored Markdown cheatsheet

Github Flavored Markdown (GFMD) is based on Markdown Syntax Guide with some overwriting as described at Github Flavored Markdown

Text Writing

It is easy to write in GFMD. Just write simply like text and use the below simple "tagging" to mark the text and you are good to go!

To specify a paragraph, leave 2 spaces at the end of the line

Headings

Large Object Motions:
(
)
{
}
[[
[]
][
]]
[m
@faun
faun / smb_fs_automount.sh
Last active February 19, 2025 01:08
Script to mount remote SMB volume using password stored in Mac OS keychain without needing admin or sudo priveliges
#!/usr/bin/env bash
# Fetch the password from the keychain if it exists
PASSWORD_ENTERED=false
ACCOUNT_NAME='login'
SERVICE_NAME='mount_volume'
PASSWORD=$(
security 2> /dev/null \
find-generic-password -w \
-a $ACCOUNT_NAME \
@faun
faun / pallindrome.rb
Created December 30, 2014 23:49
Pallindromes
class String
def pallindrome?
string = self.downcase.gsub(/[^0-9a-z]/i,'')
return false if string.length <= 1
string.reverse == string
end
def collect_possible_starts_and_end
#{ a: [0, 1], b: [3], c: [1,4,6]}
@faun
faun / com.googlecode.iterm2.plist
Last active August 29, 2015 14:09
iTerm2 settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdjustWindowForFontSizeChange</key>
<true/>
<key>AllowClipboardAccess</key>
<true/>
<key>AnimateDimming</key>
<false/>
@faun
faun / pre-commit
Last active August 29, 2015 14:09
Pre-commit hook
#!/bin/bash
## START PRECOMMIT HOOK
# Install with:
# ln -s ../../bin/pre-commit .git/hooks/pre-commit
files_modified=`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`
for f in $files_modified; do
if [[ $f == vendor/* ]]; then
echo "skipping $f"
@faun
faun / .env.example
Created August 30, 2014 08:23
Sample .env file for zinedistro
export DEVISE_SECRET_KEY='A REALLY LONG KEY'
export SECRET_TOKEN='A REALLY LONG KEY'
export SECRET_KEY_BASE='A REALLY LONG KEY'
export CARRIERWAVE_PROVIDER='AWS'
export CARRIERWAVE_AWS_ACCESS_KEY_ID='A REALLY LONG KEY'
export CARRIERWAVE_AWS_SECRET_ACCESS_KEY='A REALLY LONG KEY'
export CARRIERWAVE_REGION='us-west-1'
export CARRIERWAVE_ENDPOINT='https://s3-us-west-1.amazonaws.com/'
export CARRIERWAVE_HOST='https://s3.amazonaws.com'
export CARRIERWAVE_ASSET_HOST='http://assets.zinedistro.org'