This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/starship.toml | |
# format = "$username$all$directory$character" | |
# [┌──$username─────────────────](bold green) | |
format = """ | |
[\ue0b6$env_var\ue0b0](bold #039dfc) | |
[$python](bold green)[$username](bold green)$git_branch $git_status $character""" | |
[character] # The name of the module we are configuring is "character" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
lg = log --graph --oneline | |
br = branch -a --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | |
permission-reset = !git diff -p -R --no-color | grep -E \"^(diff|(old|new) mode)\" --color=never | git apply | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Use of lambda functions for fff custom_fake | |
* | |
* this file contains an example of how to have "nested functions" | |
* within a test case for setting an fff custom_fake for pass by reference args | |
* | |
* This method for custom fakes allows all your test code to be self contained | |
* inside a test case instead of having global functions cluttering your test | |
* code. | |
* | |
* note that lambda captures are not supported |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# python_nanomsg_logger_consumer.py | |
# run me first | |
from __future__ import print_function | |
from nanomsg import Socket, PAIR, PUB, SUB, SUB_SUBSCRIBE | |
s2 = Socket(SUB) | |
s2.connect(b"ipc:///tmp/nanologger.ipc") | |
s2.set_string_option(SUB, SUB_SUBSCRIBE, b'') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see libhashkit/fnv_32.cc from memcached | |
// Just using this as excuse to test out the Rust lang | |
// be warned on correctness, completeness, etc | |
// Should match libhashkit | |
// should also match https://www.nitrxgen.net/hashgen/ | |
// FNV hash'es lifted from Dustin Sallings work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Practical snippets for loosely atomic writes on linux | |
// Important, even more so on allocate on flush file systems such as xfs and ext4. | |
// You can learn more here: https://www.flamingspork.com/talks/ | |
// https://www.kernel.org/doc/Documentation/filesystems/ext4.txt | |
// These snippets are not perfect, if writing cross platform applications - marco guards | |
// Just trying to convey the gist | |
// The basic routine is: | |
// 1. Write data as file.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is an example tool that computes the sums of highway lengths. | |
by Frederik Ramm <[email protected]> | |
notes from Charter Chapman: | |
I picked this up in 2015 and it didn't work :( so hammered it until it worked | |
You need the latest of the old Osmium | |
https://github.com/joto/osmium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I find it useful to have return codes printed on my terminal prompt | |
# I went overboard | |
### On success print fun art! | |
# |\/| /\ / | |
# .__.. \_/ \/ | |
# \____/_ __/ | |
# /_/_/ ~/Documents | |
### on fail | |
# :( ~/Documents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I had a problem today where trying to load things into an Xvfb was not working because the xvfb | |
# was not yet initialized. The problem script is as follows: | |
# Start the Xvfb on DISPLAY :1, | |
`dirname $0`/Xvfb :1 -screen 0 1280x1024x24 -ac -br -fbdir /dev/shm & xvfbpid=$! | |
DISPLAY=:1 xli -onroot -fillscreen `dirname $0`/images/background.png | |
# The only solution I see on the web is to insert a sleep statement. | |
# I don't much like that. The solution I came up with is to wait for the display to be ready to use via xdpyinfo. | |
# The working script: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// J. Charter Chapman | |
// fnv1a_32 in javascript based on libhashkit | |
// this one actually outputs consistent with hashkit | |
// there are a couple of interesting implementations out there | |
// string to byte array [think char *] | |
function getBytes(s) { | |
var buf = []; | |
for (var i = 0; i < s.length; i++) { | |
buf.push(s.charCodeAt(i)); |