Skip to content

Instantly share code, notes, and snippets.

View jay-hankins's full-sized avatar

Jay Hankins jay-hankins

View GitHub Profile
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@rymcol
rymcol / krmosh.fish
Created June 21, 2018 11:17
workaround for kr to use mosh instead of ssh
function krmosh
mosh --experimental-remote-ip=remote $argv
end
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active March 16, 2024 13:18
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@subfuzion
subfuzion / dep.md
Last active June 14, 2023 15:46
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

How to GPG as a Scala OSS Maintainer

tl;dr Generate a GPG key pair (exercising appropriate paranoia). Send it to key servers. Create a Keybase account with the public part of that key. Use your keypair to sign git tags and SBT artifacts.

GPG is probably one of the least understood day-to-day pieces of software in the modern developer's toolshed. It's certainly the least understood of the important pieces of software (literally no one cares that you can't remember grep's regex variant), and this is a testament to the mightily terrible user interface it exposes to its otherwise extremely simple functionality. It's almost like cryptographers think that part of the security comes from the fact that bad guys can't figure it out any more than the good guys can.

Anyway, GPG is important for open source in particular because of one specific feature of public/private key cryptography: signing. Any published software should be signed by the developer (or company) who published it. Ideally, consu

@felixhageloh
felixhageloh / top-cpu.jsx
Created May 25, 2016 07:21
Example widget using the new JS + virtual DOM syntax
export const refreshFrequency = 1000;
export const command = `ps axro \"%cpu,ucomm,pid\" \
| sed -e 's/^[ \\t]*//g' -e 's/\\([0-9][0-9]*\\.[0-9][0-9]*\\)\\ /\\1\\%\\,/g' -e 's/\\ \\ *\\([0-9][0-9]*$\\)/\\,\\1/g' -e's/\\ \\ */\\_/g' \
| awk 'FNR>1' \
| head -n 3 \
| awk -F',' '{ printf \"%s,%s,%d\\n\", $1, $2, $3}' \
| sed -e 's/\\_/\\ /g'`;
const style = {
@dineshsprabu
dineshsprabu / forever_npm_start
Last active June 9, 2022 12:58
Forever for NPM applications starting with 'npm start'
/*
If your package.json file contains "start": "node ./bin/www"
Use the following command to bring up your app with forever
*/
forever start --minUptime 1000 --spinSleepTime 1000 ./bin/www
/* Check list of forever process using the command */
forever list
@pwenzel
pwenzel / ffmpeg-mkv-to-mp4.sh
Last active September 10, 2023 16:22
MKV and AVI to MP4 Conversion for Apple TV
# See also https://trac.ffmpeg.org/wiki/Encode/AAC
# direct copy
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
# direct copy video, but convert audio to AAC with default variable bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental output.mp4
# direct copy video, but convert audio to AAC with constant bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 320k output.mp4
@xu-chris
xu-chris / LowBatteryPercentage.sh
Last active January 29, 2018 21:23
Return true when Mac battery percentage is under 10 percent
#!/bin/sh
# Use this shell script in combination with ControlPlane (http://www.controlplaneapp.com) to detect
# and automatize when the battery percentage is lower or equal than 10 percent.
# For example: let ControlPlane close for you all Cloud applications when you to low battery life.
batteryPercentage=`pmset -g batt | egrep -ow '([0-9]{1,3})[^%]'`
lowbatPercentage=10
if [ ${batteryPercentage} -le ${lowbatPercentage} ]; then
@23maverick23
23maverick23 / font_awesome.rb
Last active January 30, 2022 11:38
Jekyll: Font Awesome icons Liquid tag
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Ryan Morrissey
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is