This file contains hidden or 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 | |
python -c ' | |
import sys | |
x = sys.stdin.readlines() | |
try: | |
print(x[0].decode("utf-8")) | |
except Exception as e: | |
print(repr(e.object)) | |
' <<< $'\xed' |
This file contains hidden or 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
11 bash: 2 | |
8 dash: 0 | |
3 dash: 3 | |
10 jsh: 0 | |
1 jsh: 3 | |
11 ksh: 3 | |
11 mksh: 0 | |
11 zsh: 2 |
This file contains hidden or 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
Relevant section from ''man bash'', SIGNALS: | |
> The shell exits by default upon receipt of a SIGHUP. Before exiting, an interactive shell resends the SIGHUP to all jobs, | |
> running or stopped. Stopped jobs are sent SIGCONT to ensure that they receive the SIGHUP. To prevent the shell from send‐ | |
> ing the signal to a particular job, it should be removed from the jobs table with the disown builtin (see SHELL BUILTIN | |
> COMMANDS below) or marked to not receive SIGHUP using disown -h. | |
> | |
> If the huponexit shell option has been set with shopt, bash sends a SIGHUP to all jobs when an interactive login shell | |
> exits. |
This file contains hidden or 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/sh | |
ip -o addr \ | |
| awk ' | |
$2 ~ /:$/ { | |
i=$2; | |
sub(/:$/,"",i); | |
status[i]=$9 | |
} | |
$3 == "inet" { |
This file contains hidden or 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
// Input jobs | |
var jobs = [ | |
{'hash': 'abc', 'initial': 0, 'final': 99}, | |
{'hash': 'abc', 'initial': 100, 'final': 199}, | |
{'hash': 'abc', 'initial': 200, 'final': 299}, | |
..., | |
]; | |
// Task definition | |
var task = function(description) { |
This file contains hidden or 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 python | |
from zipfile import ZipFile | |
from os import walk | |
from os.path import isfile, isdir, join | |
class Zipper(object): | |
_class = ZipFile | |
def __init__(self, zip_file, recurse=False): | |
self._zip = self._class(zip_file, 'w') |
This file contains hidden or 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 | |
shopt -s extglob | |
function isValidIdentifier { | |
typeset identifier=$1 identifierPattern='+([[:alpha:]_])+([[:alnum:]_])' |
This file contains hidden or 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
$ js wat.js | |
2 | |
0 | |
11 | |
0 | |
11 | |
0 | |
1 | |
1 | |
1 |
This file contains hidden or 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 ( | |
"os" | |
"strconv" | |
) | |
func fibonacci(n int) uint64 { | |
if n > 0 { | |
return fibonacci(n - 1) * uint64(n); |
This file contains hidden or 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/awk -f | |
function sqlite_escape(v) { | |
gsub(/'/, "''", v); | |
return v; | |
} | |
function process_line(_F, _NF) { | |
print "1:", _F[1]; | |
print "second to last:", _F[_NF - 1]; |