git remote show REMOTE_REPO_URL | grep 'HEAD branch' | cut -d' ' -f5
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
// Make emoticons from your letters for Slack | |
let words = "Alright fine, I did the needful and joined you."; | |
words = words.replace(/[.,/#!$%^&*;:{}=\-_`'~()]/g, "") | |
function emotify() { | |
let w = words.split(""); | |
for (let i = 0; i < w.length; i++) { | |
if (w[i] !== " ") { | |
w[i] = ":cs-" + w[i] + ":" |
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/bash | |
# Prints the local branches of your git repos to console. Perfect for helping clean up | |
# USAGE: git-branch-checker.sh "$HOME/git" | |
main() { | |
echo "Getting branches of each project" | |
check_git_branches "$1" | |
} |
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
import time | |
from threading import BoundedSemaphore, Thread | |
def main(): | |
max_num_threads = 100 | |
thread_limiter = BoundedSemaphore(max_num_threads) | |
# OS's have limits on the number of threads that can be opened at once, | |
# be aware of that with this number (eg: don't try something like 10,000+) |
To export SQL, you must have permissions to do so (AKA: root).
# Importing SQL
docker exec -i CONTAINER_NAME mysql -uUSERNAME -pPASSWORD DATABASE_NAME < MY_FILE.sql
# Exporting SQL
docker exec -i CONTAINER_NAME mysqldump -uroot -p DATABASE_NAME > MY_FILE.sql
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
import moment from "moment"; | |
=> const moment = require("moment"); | |
import React from "react"; | |
=> const React = require("react"); | |
import text from "../../helpers/text"; | |
=> const text = require("../../helpers/text"); | |
import Button from "../../elements/buttons/Button"; |
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
[{ | |
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", | |
"Country": "Afghanistan", | |
"ISO": "AF", | |
"Format": "NNNN", | |
"Regex": "^\\d{4}$" | |
}, { | |
"Note": "With Finland, first two numbers are 22.", | |
"Country": "Åland Islands", | |
"ISO": "AX", |
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
import requests | |
# Gets the complete list of AWS IP ranges and parses the results | |
# Usage: venv/bin/python aws_ip_range_parser.py | |
AWS_IP_URL = 'https://ip-ranges.amazonaws.com/ip-ranges.json' | |
REGIONS_TO_FILTER = [ | |
'us-east-2', | |
'us-west-2', | |
] |