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
# 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 |
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
git branch -d branch_name | |
git push origin --delete branch_name |
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/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" |
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/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 |
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
# method 1: | |
openssl rand -base64 40 | |
# method 2: | |
echo "import hashlib ; from uuid import uuid4 ; print hashlib.sha256(str(uuid4())).hexdigest()" | python - |
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/sh | |
truncate -s 0 $1 | |
# example, to erase the logs: | |
# sudo truncate -s 0 /var/log/apache2/* | |
# sudo truncate -s 0 /var/log/nginx/* |
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/sh | |
# list ports in use | |
# http://askubuntu.com/a/278455/142145 | |
sudo netstat -peanut |
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/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 |
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
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>"); |
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
# 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: |
NewerOlder