Skip to content

Instantly share code, notes, and snippets.

View Kyle-Falconer's full-sized avatar

Kyle Falconer Kyle-Falconer

View GitHub Profile
@Kyle-Falconer
Kyle-Falconer / Microsoft.PowerShell_profile.ps1
Created November 27, 2019 23:22
Simple Powershell Profile
# C:\Users\username\Documents\WindowsPowershell\Microsoft.PowerShell_profile.ps1
#
# to allow this to run, the ExecutionPolicy needs to be changed. In order run:
# Get-ExecutionPolicy -List
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Get-ExecutionPolicy -List
# creates the *nix `which`-like command
# https://stackoverflow.com/a/65148/940217
@Kyle-Falconer
Kyle-Falconer / del_branch
Created September 1, 2016 17:03
delete local and remote branch
git branch -d branch_name
git push origin --delete branch_name
@Kyle-Falconer
Kyle-Falconer / auth_me
Last active August 31, 2016 21:00
Upload and append public key to remote computer's authorized_keys
#/bin/sh
# if you need a new public/private key pair, use:
# ssh-keygen
scp ~/.ssh/id_rsa.pub user@example.com:/home/user/.ssh/uploaded_key.pub
ssh user@example.com "echo `cat ~/.ssh/uploaded_key.pub` >> ~/.ssh/authorized_keys"
@Kyle-Falconer
Kyle-Falconer / run_docker_with_bash
Created August 17, 2016 18:57
start a docker container, into a bash prompt
#!/bin/sh
# Assuming an Ubuntu Docker image or similar with bash
# here $1 is the name of the docker container to run
docker run -it $1 /bin/bash
@Kyle-Falconer
Kyle-Falconer / randstr40
Last active August 15, 2016 18:56
make a random string
# method 1:
openssl rand -base64 40
# method 2:
echo "import hashlib ; from uuid import uuid4 ; print hashlib.sha256(str(uuid4())).hexdigest()" | python -
@Kyle-Falconer
Kyle-Falconer / empty.sh
Created August 12, 2016 20:36
Empty a file in place.
#!/bin/sh
truncate -s 0 $1
# example, to erase the logs:
# sudo truncate -s 0 /var/log/apache2/*
# sudo truncate -s 0 /var/log/nginx/*
@Kyle-Falconer
Kyle-Falconer / ls_ports.sh
Last active August 12, 2016 20:37
list ports in use
#!/bin/sh
# list ports in use
# http://askubuntu.com/a/278455/142145
sudo netstat -peanut
@Kyle-Falconer
Kyle-Falconer / proxy_start.sh
Created June 13, 2016 23:01
Proxy Autostart/auto-configure shell script for Mac OS 10.11.5
#!/bin/sh
# Proxy Autostart/auto-configure for Mac OS 10.11.5
# written by Kyle Falconer <Kyle.Falconer@vta.org> June 2016
#
# cntlm was setup using the instructions found at:
# http://blog.hoachuck.biz/blog/2013/03/21/howto-set-cntlm-on-mac-os-x/
#
# cntlm autostarts using launchctl
# see the plist at
@Kyle-Falconer
Kyle-Falconer / auto-generated range ticks
Last active February 17, 2016 18:24 — forked from dudleystorey/auto-generated range ticks
Creates an auto-generated series of option values to generate ticks for Chrome & IE10 range sliders. slider requires min,max,step and list attributes.
function ticks(element) {
if ('list' in element && 'min' in element && 'max' in element && 'step' in element) {
var datalist = document.createElement('datalist'),
minimum = parseInt(element.getAttribute('min')),
step = parseInt(element.getAttribute('step')),
maximum = parseInt(element.getAttribute('max'));
datalist.id = element.getAttribute('list');
var options = [];
for (var i = minimum; i < maximum + step; i = i + step) {
options.push("<option value=" + i + "></option>");
@Kyle-Falconer
Kyle-Falconer / serve.py
Created October 2, 2015 17:04
simple webserver for Python 3, with commented notes for one-liner web service.
# Python 2:
# python -m SimpleHTTPServer
#
# Python 3:
# python -m http.server
import http.server
def start_server(port=8000, bind="", cgi=False):
if cgi==True: