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
for path in "$@"; do | |
# Get the mime-type | |
MIMETYPE=$(file --mime-type -b "$path") | |
if [[ "$MIMETYPE" == "image/jpeg" ]]; then | |
# Use jp2a if image is jpg | |
jp2a "$path" | |
elif [[ "$MIMETYPE" =~ image/* ]]; then | |
# Convert image to temporary jpg | |
TMPPATH="/tmp/.$path.jpg" |
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 python3 | |
import sys | |
import time | |
import socket | |
import _thread | |
import readline | |
if len(sys.argv) < 3: | |
print('usage: pysock [options] server port') |
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 python3 | |
import re | |
import os | |
import sys | |
import time | |
import hashlib | |
import optparse | |
parser = optparse.OptionParser() |
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 | |
for filepath in $@; do | |
if [[ -f "$filepath" ]]; then | |
filepath_bak=$filepath.bak | |
if [[ -f "$filepath_bak" ]]; then | |
i=1 | |
filepath_bak_i=$filepath_bak".$i" | |
while [[ -f "$filepath_bak_i" ]]; do | |
((i++)) |
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 | |
usage() { | |
echo "usage: $(basename $0) github-user github-repository" | |
echo " $(basename $0) github-user/github-repository" | |
} | |
if [[ "$#" -ne 1 && "$#" -ne 2 ]]; then # require exactly 1 or 2 arguments | |
usage && exit | |
elif [[ "$#" -eq 1 && "$1" != *"/"* ]]; then # if one argument provided, require a slash |
NewerOlder