Skip to content

Instantly share code, notes, and snippets.

@dualbus
dualbus / gist
Created May 17, 2014 01:08
gist
"@diana_clarke: I'll never know why I miscarried, but I do know it happened the weekend the internet decided to toss abuse my way. @shanley is a bully. #!ok"
[...]
"@sindarina: @diana_clarke I know this is traumatic, but ... to insinuate it being linked to @shanley, that feels like crossing a line to me. Not OK "
"@juliepagano: @diana_clarke I am really sorry for your loss. I cannot imagine how hard that is. However, the implication you’re making here is troubling."
Como dijo el Comediante: "It's a joke. It's all a fuckin' joke."
void
bubblesort(int A[], unsigned int n)
{
int i, j;
for(i = 0; i < n; i++) {
for(j = i; j < n; j++) {
if(A[i] > A[j]) {
int t = A[j];
A[j] = A[i];
zsh:
+zsh:4> command -v xyz
xyz
+zsh:5> unset xyz
+zsh:6> command -v xyz
xyz
+zsh:8> PATH=''
+zsh:9> command -v xyz
xyz
+zsh:10> PATH=:
#!/bin/bash
for shell in zsh ksh mksh dash bash /bin/bash 'busybox sh'; do
echo "$shell":
$shell <<'eof'
set -x
PATH=
echo "PATH=$PATH"
ls
eof
#!/bin/bash
stty=$(stty -g)
trap 'stty "$stty"' EXIT
stty raw
IFS= read -rs -N1 a
while read -t0; do
IFS= read -rs -N1 b
a+=$b
done
#include <stdlib.h>
#include <sys/time.h>
#include <signal.h>
void on_sigalrm(int sig) {
return;
}
int main(int argc, char *argv[]) {
float wait;
@dualbus
dualbus / ifs
Last active August 29, 2015 14:13
#!/bin/bash
: <<\eof
Behavior of shells when IFS='\'
The case when IFS='\' is tricky for the following situations:
- read with -r
- read without -r
- a parameter expansion, unquoted, that contains the backslash
#!/bin/bash
shopt -s extdebug extglob
k0ud3() {
local cmd=$1
case $cmd in
+([[:digit:]])@([*+/-])+([[:digit:]])):;;
*)! :;;
esac && eval echo "$(($cmd))"
#!/bin/bash
IFS= read -rd '' index_filter <<\Command
git ls-files -s | \
awk '
BEGIN { FS="\t" }
$2 ~ /(^|\/)-i$/ {next}
$2 ~ /Makefile$/ {next}
$2 ~ /[#~]$/ {next}