Skip to content

Instantly share code, notes, and snippets.

View diegogub's full-sized avatar
👽

Diego Guraieb diegogub

👽
View GitHub Profile
@diegogub
diegogub / 00-NOTES.md
Created April 24, 2024 18:57 — forked from krisleech/00-NOTES.md
Notes on Clojure ring handlers and middleware

Ring handler a function which accepts a request (map) and returns a response (map).

Ring middleware

function (handler, &args -> function(request -> response) because it is a closure handler and &args are in scope within the returned handler function.

a function which accepts a "next handler" (the next handler in the chain) + any extra arguments and returns a handler (function), which will accept a request and return a response.

for d in `find $1 -name ".git"`;do
echo $d
cd ~/${d%/.git} && git status -s
done
@diegogub
diegogub / .tmux.conf
Created August 31, 2021 11:21
tmux config
set -g prefix C-s
bind C-s send-prefix
unbind C-b
set -g base-index 1
set -g escape-time 20
set -g mouse on
bind h select-pane -L
bind j select-pane -D
@diegogub
diegogub / sincro.sh
Last active July 1, 2021 15:10
Rsync between server a clients (push/pull)
#!/bin/bash
OPTIONS=-azPv
if [ "$1" == "push" ];
then
echo $SIN_LOCAL_FOLDER
echo "to"
echo $SIN_REMOTE_FOLDER
rsync $OPTIONS --delete --backup --backup-dir=$SIN_BACKUP_REMOTE $SIN_LOCAL_FOLDER $SIN_REMOTE_HOST:$SIN_REMOTE_FOLDER
@diegogub
diegogub / list-deps.cr
Created August 28, 2018 11:52 — forked from bcardiff/list-deps.cr
List binary dependencies to build a minimal docker image from scratch
unless ARGV.size > 0
puts " Missing executable file argument"
puts " Usage (in a Dockerfile)"
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable"
exit 1
end
executable = File.expand_path(ARGV[0])
unless File.exists?(executable)
import macros, json
type Event = ref object of RootObj
id: string
type TestMade = ref object of Event
name: string
type Test = ref object of Event
extern crate bincode;
extern crate time;
extern crate rustc_serialize;
use std::fs::OpenOptions;
use std::fs::File;
use std::io::prelude::*;
use bincode::SizeLimit;
use std::io::SeekFrom;
use std::mem;