Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
save=$(bind -p; bind -X)
function clean-up {
bind -r '\C-i'
bind -f /dev/stdin <<< "$save"
}
trap 'clean-up' RETURN
function write-options {
@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}
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Arrays;
import java.io.FileNotFoundException;
import java.io.IOException;
public class A {
public static int solution(int N) {
int[] seen;
int i;