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
#!/bin/bash | |
SCRIPTNAME=$(basename "$0") | |
function realpath () { | |
f=$@; | |
if [ -d "$f" ]; then | |
base=""; | |
dir="$f"; | |
else | |
base="/$(basename "$f")"; |
import os
import sys
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
# Rules for transparent proxying | |
iptables -N NO_PROXY -t nat | |
iptables -A NO_PROXY -t nat -d 0.0.0.0/8 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 10.0.0.0/8 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 127.0.0.0/8 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 169.254.0.0/16 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 172.16.0.0/12 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 192.168.0.0/16 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 224.0.0.0/4 -j ACCEPT | |
iptables -A NO_PROXY -t nat -d 240.0.0.0/4 -j ACCEPT |
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
// Here is an extremely simple version of work scheduling for multiple | |
// processors. | |
// | |
// The Problem: | |
// We have a lot of numbers that need to be math'ed. Doing this on one | |
// CPU core is slow. We have 4 CPU cores. We would thus like to use those | |
// cores to do math, because it will be a little less slow (ideally | |
// 4 times faster actually). | |
// | |
// The Solution: |
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
#!/usr/bin/env zsh | |
FO=$(cat) | |
X=$(head -n 1 <<<$FO) | |
YL=$(echo $FO|wc -l|bc) | |
FF=$((echo $X|tr 1 0;echo $FO;echo $X|tr 1 0)|addl 0\ |addr \ 0) | |
for L in {1..$YL};do | |
for C in {1..$(echo $X|awk '{print NF}')}; do | |
echo $FF | sed -n $L,$((L+2))p | cut -d \ -f $C,$((C+1)),$((C+2)) | xargs | { | |
read B | |
if echo $B | grep -q '. . . . 1 . . . .';then |
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
package main | |
import ( | |
"bytes" | |
"errors" | |
"fmt" | |
"html/template" | |
"log" | |
"net" | |
"net/mail" |
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
function addb | |
while read -l line | |
echo $line | |
end | |
if count $argv >/dev/null | |
echo $argv[1] | |
end | |
end |
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
(defun send-region-to-clipboard (START END) | |
;; Place https://github.com/skaji/remote-pbcopy-iterm2/blob/master/pbcopy as `cpbcopy` | |
(interactive "r") | |
(let ((infile (make-temp-file "send-region-to-clipboard"))) | |
(write-region (buffer-substring (region-beginning) (region-end)) | |
nil | |
infile | |
nil | |
'nomsg) | |
(with-temp-buffer |
NewerOlder