Skip to content

Instantly share code, notes, and snippets.

@cr0wg4n
cr0wg4n / switch-github-user.sh
Last active March 28, 2024 04:38
A Bash script to interchange multiple GitHub users in a unique machine
#!/bin/bash
gh_user="${1:-Nothing}"
if [ "$gh_user" == 'USERNAME_1' ]; then
ssh-add -D
git config --global user.email "USERNAME_1_EMAIL"
ssh-add /PRIVATE_KEY_PATH/.ssh/github-USERNAME_1
elif [ "$gh_user" == 'USERNAME_2' ]; then
ssh-add -D
git config --global user.email "USERNAME_2_EMAIL"
@bean5
bean5 / gist:1245ecbb8976099daf5dcc8c2e76e8cd
Created June 7, 2021 15:11 — forked from jaxbot/gist:5748513
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
from scapy.all import *
import requests
import time
MAGIC_FORM_URL = 'http://put-your-url-here'
def record_poop():
data = {
"Timestamp": time.strftime("%Y-%m-%d %H:%M"),
"Measurement": 'Poopy Diaper'
}
@mlota
mlota / README.md
Last active April 6, 2016 17:54
Inspirational Quotes Widget for Dashing

##Preview

##Description

A simple Dashing widget to display a random inspirational quote. The widget is set to update every 4 hours, however this is easily configurable in the job file. The data is pulled from the free api provided by Forismatic.com.

##Installation

@mvndaai
mvndaai / echo_with_colors.sh
Created September 27, 2014 02:41
Bash echo with colors
#!/bin/sh
echo-bold(){
echo -e '\e[1m'$1'\e[0m'
}
echo-black(){
#You probably shouldn't use this
echo -e '\e[30m'$1'\e[0m'
}
echo-red(){
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
@danriti
danriti / hipchat-v2.sh
Last active July 19, 2021 10:49
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
@jaxbot
jaxbot / gist:5748513
Created June 10, 2013 12:58
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@pixelhandler
pixelhandler / pre-push.sh
Last active May 17, 2024 12:12
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";