Skip to content

Instantly share code, notes, and snippets.

View shollingsworth's full-sized avatar

Steven Hollingsworth shollingsworth

  • SkySafe.io
  • United States
  • X @_stevo
View GitHub Profile
@vectoroc
vectoroc / GlobalMercator.php
Created September 11, 2012 11:36
Port of GlobalMercator from python to php
<?php
###############################################################################
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008
# Global Map Tiles Classes
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326,
# generate a simple HTML viewers based on Google Maps and OpenLayers
# Author: Klokan Petr Pridal, klokan at klokan dot cz
# Web: http://www.klokan.cz/projects/gdal2tiles/
#
###############################################################################
@soardex
soardex / gist:5474b5cf3f263d6acd77
Created July 11, 2015 15:31
Perlbrew on CentOS 7
# install perlbrew
sudo yum install -y perl perl-CPAN perl-CPAN-Meta
sudo cpan App::cpanminus
sudo cpanm install App::perlbrew
# install cpanm and perl latest
perlbrew install-cpanm
perlbrew install-patchperl
perlbrew install 5.22.0
import board
import time
import neopixel
from random import choice, randint
leds = neopixel.NeoPixel(board.RX, 50, pixel_order=neopixel.RGB)
color = (128, 0, 255)
def permutations(iterable, r=None):
@ionrock
ionrock / lockfile.py
Created June 29, 2012 04:14
A file locking example
"""
A file lock implementation that tries to avoid platform specific
issues. It is inspired by a whole bunch of different implementations
listed below.
- https://bitbucket.org/jaraco/yg.lockfile/src/6c448dcbf6e5/yg/lockfile/__init__.py
- http://svn.zope.org/zc.lockfile/trunk/src/zc/lockfile/__init__.py?rev=121133&view=markup
- http://stackoverflow.com/questions/489861/locking-a-file-in-python
- http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/
- http://packages.python.org/lockfile/lockfile.html
@rezen
rezen / aws_actions.txt
Last active June 16, 2023 10:55
It's nice having a list of AWS IAM actions
account:DisableRegion
account:EnableRegion
account:ListRegions
activate:CreateForm
activate:GetAccountContact
activate:GetContentInfo
activate:GetCosts
activate:GetCredits
activate:GetMemberInfo
activate:GetProgram
@loisaidasam
loisaidasam / README.md
Last active October 19, 2023 16:07
Sort git tags by semver

If you're like me and you use semver for versioning your tags, you probably hate when you do this:

$ git tag -l
0.1.0
0.10.0
0.2.0
0.3.0
0.3.1
0.4.0

0.5.0

@lukicdarkoo
lukicdarkoo / configure.sh
Last active November 22, 2023 04:37
Raspberry Pi: AP + client mode
#!/bin/sh
# The script configures simultaneous AP and Managed Mode Wifi on Raspberry Pi Zero W (should also work on Raspberry Pi 3)
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s WifiSSID WifiPass APSSID APPass
# Licence: GPLv3
# Author: Darko Lukic <lukicdarkoo@gmail.com>
# Special thanks to: https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/
MAC_ADDRESS="$(cat /sys/class/net/wlan0/address)"
CLIENT_SSID="${1}"
CLIENT_PASSPHRASE="${2}"
@qistoph
qistoph / awk_netstat.sh
Created August 6, 2020 07:55
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Based on gist https://gist.github.com/staaldraad/4c4c80800ce15b6bef1c1186eaa8da9f
# - added TCP states
awk 'BEGIN{states["01"]="TCP_ESTABLISHED"
states["02"]="TCP_SYN_SENT"
states["03"]="TCP_SYN_RECV"
states["04"]="TCP_FIN_WAIT1"
states["05"]="TCP_FIN_WAIT2"
states["06"]="TCP_TIME_WAIT"
states["07"]="TCP_CLOSE"
@jppommet
jppommet / int2ip.js
Last active December 26, 2023 13:44
javascript conversion from ip address to long integer and vice versa
function int2ip (ipInt) {
return ( (ipInt>>>24) +'.' + (ipInt>>16 & 255) +'.' + (ipInt>>8 & 255) +'.' + (ipInt & 255) );
}
@wuchengwei
wuchengwei / dataURL to blob and blob to dataURL
Last active February 15, 2024 16:50
dataURL to blob and blob to dataURL
//**dataURL to blob**
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
}