Skip to content

Instantly share code, notes, and snippets.

View ctcherry's full-sized avatar
🎯
Rusty Gopher

Chris Cherry ctcherry

🎯
Rusty Gopher
View GitHub Profile
@ctcherry
ctcherry / ringo.rs
Last active June 28, 2023 20:58 — forked from timClicks/ringo.rs
Ring buffer implementation based on https://www.youtube.com/watch?v=TQVwv_e_rMw
#[derive(Debug)]
struct RingBuffer<T: Clone> {
storage: Vec<Option<T>>,
read_idx: usize,
write_idx: usize,
len: usize
}
#[derive(Debug, PartialEq)]
struct Full;
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/deploy/appname/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/deploy/appname/public;
@ctcherry
ctcherry / GIT Memory Issue global
Created October 15, 2019 18:12 — forked from radermacher/GIT Memory Issue
GIT: If run into memory issue on server or local, reduce memory usage by
git config --global core.packedGitWindowSize 16m
git config --global core.packedGitLimit 64m
git config --global pack.windowMemory 64m
git config --global pack.packSizeLimit 64m
git config --global pack.thread 1
git config --global pack.deltaCacheSize 1m
# Source: http://uberspace.de/dokuwiki/development:git#ram-nutzung
@ctcherry
ctcherry / gist:db5891f2e2307354e1576ec54b84de16
Last active May 23, 2018 20:51
shell function to make a new tmux session named after the current directory name, and switch to it. mnemonic: make session
mks() {
sname=$(basename ${PWD//./-})
tmux has-session -t $sname 2>/dev/null
if [ "$?" -eq 1 ] ; then
tmux new-session -d -s $sname
fi
tmux switch -t $sname
}
@ctcherry
ctcherry / keybase.md
Created September 27, 2017 20:36
keybase.md

Keybase proof

I hereby claim:

  • I am ctcherry on github.
  • I am ctcherry (https://keybase.io/ctcherry) on keybase.
  • I have a public key ASCaieYr6UidWAOl-b3LeXteElghTPrxRW2NmgjA0KQDUAo

To claim this, I am signing this object:

#!/bin/bash
echo "running"
KEY="$(echo -n $(cat ~/.screenshot_uploader.secret))"
HOST="s8t.us"
SFILE="$(find /Users/USER/Desktop -mtime -5s -type f -name 'Screen Shot*' | head -1)"

Keybase proof

I hereby claim:

  • I am ctcherry on github.
  • I am ctcherry (https://keybase.io/ctcherry) on keybase.
  • I have a public key whose fingerprint is 57D4 59CF 8EC5 795E D211 199A 0C9C EC84 6868 75D1

To claim this, I am signing this object:

@ctcherry
ctcherry / gist:7132168
Last active December 26, 2015 09:49
Very complicated way to print out "Hello, World!"
require 'digest/md5'
require 'base64'
require 'stringio'
data = StringIO.new(Base64.decode64(DATA.read))
byte_hashes = []
while d = data.read(16)
byte_hashes << d.unpack('H*').first
end
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
local cb=$(current_branch)
if [ -n "$cb" ]; then
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(parse_git_dirty)$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
@ctcherry
ctcherry / iOSclass
Created February 1, 2012 18:28 — forked from KruegerDesigns/ios.html.class.js
Add mobile class to html tag for mobile devices along with the mobile type if known
// adds mobile class, and mobile os to html tag
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
if (deviceAgent.match(/(iphone|ipod|ipad)/)) {
$('html').addClass('ios');
$('html').addClass('mobile');
}
if (deviceAgent.match(/android/)) {