Skip to content

Instantly share code, notes, and snippets.

function do_something() {
print("first implementation")
}
function do_something() {
print("second implementation")
}
do_something() // prints the latest implementation
function __escape_tmux() {
if [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; then
printf "\033Ptmux;\033$@\033\\" >/dev/tty
else
echo -ne "$@"
fi
}
runHtop() {
__escape_tmux "\033]1337;PushKeyLabels\a"
#!/bin/bash
### tiktoff
# usage: tiktoff
#
# STDIN receives 1 url to a tiktok video
# tiktoff will rip the video
# STDERR prints out the filename of the ripped video
#
###
macro do_debug(name)
module MyDebug{{name.id}} # use the run macro to md5 the name or something
def name
{{name}}
end
def debug(thing)
puts("#{name}: #{thing}")
end
end
include MyDebug{{name.id}} # use the run macro to md5 the name or something
#!/usr/bin/env crystal
class Thread
class MyThread
@thread : LibC::PthreadT
setter proc : Proc(Pointer(Void), Pointer(Void))
def initialize
@thread = uninitialized LibC::PthreadT
@proc = uninitialized Proc(Pointer(Void), Pointer(Void))
@Willamin
Willamin / retry.rb
Last active August 7, 2018 18:27
Travis Retry but in Ruby
#!/usr/bin/env ruby
count = 1
attempts = (ENV['TRAVIS_RETRY'] || 3).to_i
command = ARGV.join(" ")
puts "Attempting to run \"#{command}\". Will retry up to #{attempts} times."
attempts.times do |attempt_number|
attempt_number += 1
$ # no cache crystal run
$ rm -rf $(crystal env CRYSTAL_CACHE_DIR)/*
$ time crystal run sample.cr
hello
real 0m1.289s
user 0m1.916s
sys 0m0.375s
$ # cached crystal run
$ # no cache crystal run
$ rm -rf $(crystal env CRYSTAL_CACHE_DIR)/*
$ time crystal run sample.cr
hello
real 0m1.289s
user 0m1.916s
sys 0m0.375s
$ # cached crystal run
$ # no cache crystal run
$ rm -rf $(crystal env CRYSTAL_CACHE_DIR)/*
$ time crystal run sample.cr
hello
real 0m1.289s
user 0m1.916s
sys 0m0.375s
$ # cached crystal run
raspberry pi 0 w:
$ 10.00
https://www.adafruit.com/product/3400
lipo shim:
$ 9.95
https://www.adafruit.com/product/3196
lipo battery (3.7v 2000mAh):
$ 12.50