Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Saleeba tomsaleeba

View GitHub Profile
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active Oct 29, 2022
shell/bash generate random alphanumeric string
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@championofblocks
championofblocks / wav-mp3
Last active Sep 21, 2022
Command line bash to convert all wav to mp3
View wav-mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done
@inadarei
inadarei / base64.js
Created Jan 6, 2013
base64 encode/decode in Node.js
View base64.js
var url = "http://cdn1.giltcdn.com/images/share/uploads/0000/0001/7250/172502872/420x560.jpg";
var encoded = new Buffer(url).toString('base64');
var decoded = new Buffer(encoded, 'base64').toString('ascii')
console.log(encoded);
console.log(decoded);
@willurd
willurd / web-servers.md
Last active Nov 25, 2022
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@phuesler
phuesler / netcat_tcp_server.sh
Last active Apr 21, 2022
Simple tcp server using netcat
View netcat_tcp_server.sh
#!/bin/bash
# Simple tcp server using netcat
# - depending on the netcat version either use nc -l 5555 or nc -l -p 5555
# - verify with `telnet locahhost 5555`
# - quit the telnet with `ctrl-]` and then type quit
# - the while loop is there so reopen the port after a client has disconnected
# - supports only one client at a time
PORT=5555;
while :; do nc -l -p $PORT | tee output.log; sleep 1; done
@XVilka
XVilka / TrueColour.md
Last active Nov 23, 2022
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

View country-bounding-boxes.py
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
View gist:bf86ff1961cccdf8be06
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@Daenyth
Daenyth / debug_requests.py
Created Aug 27, 2015
Enable debug logging for python requests
View debug_requests.py
import requests
import logging
import httplib
# Debug logging
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
req_log = logging.getLogger('requests.packages.urllib3')
req_log.setLevel(logging.DEBUG)
@vancluever
vancluever / amifind.sh
Created Jan 26, 2016
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
View amifind.sh
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \