Skip to content

Instantly share code, notes, and snippets.

View Eriner's full-sized avatar

Matt Hamilton Eriner

View GitHub Profile
#!/usr/bin/env zsh
input=($(<${1}))
for word in ${input}; do
if [[ ${word} == $(print -n ${word} | rev) ]]; then
print "True"
else
print "False"
fi
#!/usr/bin/env zsh
numbers=($(<${1}))
for n in {1..${#numbers}..2}; do
first=${numbers[n]}
second=${numbers[$(( n + 1 ))]}
sum=0
for i in {${first}..${second}}; do
#!/usr/bin/env zsh
# xxd ignores the first byte for some reason, so pad it
hex="66 $(<${1})"
print ${hex} | xxd -r
#!/usr/bin/env zsh
numbers=($(<${1}))
results=()
# getting 0-10, ..., 90-99
for i in {0..9}; do
lower=$(( ${i} * 10 ))
upper=$(( ${lower} + 9 ))
#!/usr/bin/env zsh
# contents of file in an array, read from file as argv[1]
sums=($(<${1}))
# get the number of pairs
for n in {1..${#sums}..2}; do
first=${sums[${n}]}
second=${sums[$(( ${n} + 1 ))]}
# dsnooped input
# dsnooped allows multiple applications to use an input device (microphone)
# without dsnoop, devices are exclusive, and the mic can only be used by one app at a time.
pcm.dsnooped {
type dsnoop
ipc_key 5978293 # must be unique for all dmix plugins!!!!
ipc_key_add_uid yes
slave {
pcm "hw:Microphone"
channels 2