Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 28, 2024 21:36
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 27, 2024 16:50
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@jiaaro
jiaaro / install_nodejs
Last active August 8, 2016 12:50
Put the following files in a folder called `bin` (so they'll be `bin/post_compile` and `bin/install_nodejs`)
#!/usr/bin/env bash
set -eo pipefail
NODE_VERSION=$(curl --silent --get https://semver.io/node/stable)
NODE_BASENAME=node-v${NODE_VERSION}-linux-x64
NODE_ARCHIVE="http://nodejs.org/dist/v${NODE_VERSION}/${NODE_BASENAME}.tar.gz"
# make a temp directory
tempdir="$( mktemp -t node_XXXX )"
rm -rf $tempdir
@aaronvanston
aaronvanston / form.html
Created May 7, 2016 11:01
Bootstrap 4 + Parsley JS
$("#parsleyForm").parsley({
errorClass: 'has-danger',
successClass: 'has-success',
classHandler: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsContainer: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsWrapper: '<span class="text-help">',
@bergie
bergie / README.md
Last active July 4, 2024 00:48
Arduino CLI with ESP8266
  • Install Arduino IDE to /opt/arduino
  • Install PubSubClient and MsgFlo
  • Edit /opt/arduino/libraries/PubSubClient/src/PubSubClient.h and set a bigger buffer size (for example 512)
  • Add ESP8266 board URL:
/opt/arduino/arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
  • Install board package
@forkfork
forkfork / prelimstreamdocs.md
Last active May 27, 2020 17:22
Redis Streams

XADD streamname [MAXLEN items] * field value [field value ...]

Adds a set of fields with values to the specified stream. If MAXLEN items are exceeded, items are removed from the beginning of the stream to bring the length down to MAXLEN. The "*" field is to autogenerate an item ID, but can be overriden.

Return value

Simple string reply: epoch time (in milliseconds) followed by a .N (for differentiating multiple events on the same millisecond)