Skip to content

Instantly share code, notes, and snippets.

View sh4t's full-sized avatar

Justin Shattuck sh4t

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 20, 2026 23:40
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@seanbehan
seanbehan / Gemfile
Created June 23, 2012 00:22
Export Tables from MySQL as JSON
source 'https://rubygems.org'
gem "activerecord"
gem "mysql
@pezz
pezz / crypto-pi-root.md
Last active December 17, 2020 15:40
Archlinux ARM encrypted root

Intro

Just some FYI, to get started:

  • I'm using a 16 GB Sandisk SD card.
  • I have a model B Pi, 512 MB RAM (not really relevant, thought I'd mention it).
  • Monitor and keyboard connected to the Pi itself, for now.
  • Network working, internet access.
#!/bin/sh
#get GitHub user name if it is not provided
if [ $# -lt 1 ]; then
echo -n "Enter GitHub user name: "
read _githubUsername
else
_githubUsername=$1
fi
@pdeschen
pdeschen / initd
Created May 12, 2013 18:10
CentOS service initd erb template. Ready to use in Opscode Chef or replace template variables with your own hard-coded value. Takes into account priority/nice, sudo user, and /etc/sysconfig/ Support start, stop, restart, console.
#!/bin/sh
#
# <%=@service%> This shell script takes care of starting and stopping
# the <%=@service%> service.
#
# chkconfig: 2345 65 35
# description: <%=@description%>
#
SERVICE=<%=@service%>
@zarmstrong
zarmstrong / ec2tags.rb
Last active July 4, 2016 19:03 — forked from drohr/ec2tags.rb
replaces spaces with pipes to take into account non-word (\w) characters in key or value.
require 'facter'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("ec2dtag --filter \"resource-id=#{instance_id}\" --region #{region} | cut -f 4-|awk 'BEGIN{FS=\" \";OFS=\"|\"} {$1=$1; print $0}'")
tags.scan(/(.*)\|+(.*)/) do |key, value|
fact = "ec2_tag_#{key}"
Facter.add(fact) { setcode { value } }
end
@tobert
tobert / diskstats_linux.go
Last active April 15, 2021 15:04
Read /proc/diskstats on Linux with Go with minimum overhead
package main
// Usage: go run diskstats_linux.go
// public domain
import (
"bytes"
"io/ioutil"
"log"
"strconv"
)
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active June 5, 2026 13:42
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@andrewsomething
andrewsomething / cloud_init_runcmd.py
Last active February 10, 2026 08:20
This script takes a cloud-config file as input and returns the 'shellified' script that would be produced by cloudinit from the runcmd stanza.
#!/usr/bin/python
"""
This script take a cloud-config file as input and returns the 'shellified'
script that would be produced by cloudinit from the runcmd stanza.
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/config/cc_runcmd.py
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/util.py#L1708
"""
@tranzium
tranzium / autoview-syntax.txt
Last active June 9, 2025 16:42
TradingView can now become automated trading.
---------- Usage
The syntax created by these parameters is placed in an alert's description on TradingView
to be utilized by Autoview, a Chrome Extension.
Autoview: https://chrome.google.com/webstore/detail/autoview/okdhadoplaoehmeldlpakhpekjcpljmb
> Website: https://autoview.with.pink
> Help: https://use.autoview.with.pink
> Discord: https://discordapp.com/invite/BFz8VPn
TradingView: https://tradingview.go2cloud.org/aff_c?offer_id=2&aff_id=1187