Skip to content

Instantly share code, notes, and snippets.

View ddevault's full-sized avatar

Drew DeVault ddevault

View GitHub Profile
@Cloudef
Cloudef / git-archive-all
Created June 15, 2017 13:38
wlc release scripts
#!/bin/bash
# Archive git project including all submodules
# Usage: git archive-all <name> <ref>
set -eEuo pipefail
current="$(git rev-parse --abbrev-ref HEAD)"
toplevel="$(git rev-parse --show-toplevel)"
toplevel="${toplevel##*/}"
name="${1:-$toplevel}"
@Earnestly
Earnestly / statusbar.adoc
Last active August 7, 2023 09:06
Simple reactive statusbar
Table of Contents

The main event loop

statusdir=$XDG_RUNTIME_DIR/statusbar
mkdir -pm0700 "$statusdir"
import sys
import os
import re
lines = [l.rstrip() for l in sys.stdin.readlines()]
bt = re.compile(".*Backtrace: .*sway.*\[(0x[a-f\d]+)\]")
for line in lines:
result = bt.match(line)
#!/bin/bash
DEBUG=0
while read line; do
mkvinfo "$line" > currentmkvinfo.info
currentFontName=""
currentFontDigit=1
while read info; do
currentLine=`echo $info | sed 's/|//g' | sed 's/+//g'`
currentLineText=`echo $currentLine | sed 's/[0-9]//g'`
currentLineDigit=`echo $currentLine | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/://g'`
@rajeshsegu
rajeshsegu / BrowserDetectProtocol.js
Created September 13, 2012 19:26
Detect Browser Custom Protocols
<html>
<head>
<title>Detect Custome Protocol</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
</head>
<body>
<input id="protocol" value="" placeholder="custom protocol"/>
<button id="launch">Launch</button>
<!-- Mozilla Only -->
<iframe id="hiddenIframe" src="about:blank" style="display:none"></iframe>
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@endolith
endolith / Has weird right-to-left characters.txt
Last active April 7, 2024 01:38
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶