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
# https://docs.djangoproject.com/en/dev/topics/security/#ssl-https | |
if '1' in str(os.getenv('SECURE_SSL')): # SECURE_SSL=1 | |
SECURE_SSL_REDIRECT = True | |
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') | |
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
echo "word1 :blush: word2" | sed 's/:.*://' | |
echo ":blush: word2" | sed 's/:.*://' | sed "s/^[ \t]*//" | sed 's/[ \t]*$//' |
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
# https://discordapp.com/developers/docs/resources/webhook#execute-webhook | |
import requests | |
import json | |
import os | |
# prevent 400 ERROR | |
DESCRIPTION_MAX_LENGTH = 1900 | |
TITLE_MAX_LENGTH = 255 | |
TIMEOUT = 5 | |
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
set ~/Applications/name.app | |
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f "$@" |
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
node-sass --include-path ~/node_modules ./static/src/index.scss ./static/src/index.css |
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
CREATE OR REPLACE FUNCTION basename(path text) RETURNS text AS $$ | |
SELECT reverse((regexp_split_to_array(reverse($1), '/'))[1]) | |
$$ | |
LANGUAGE SQL IMMUTABLE; | |
SELECT basename('/Users/username/git/owner/repo'); | |
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
#!/usr/bin/env bash | |
# https://stackoverflow.com/questions/2740806/python-sqlite-database-is-locked | |
function sqlite3() { | |
executable="$(which sqlite3)" || exit | |
out="$("$executable" "$@" 2>&1)" && echo "$out" && return || { | |
[[ "$out" == *"locked"* ]] && exit; echo "$out" 1>&2 && exit 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
set -- "word1 word2 word3" | |
printf "/%s" $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$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
ipconfig getifaddr en1 # internal IP | |
curl -s ipecho.net/plain # public IP |
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
defaults write .GlobalPreferences com.apple.sound.beep.sound /System/Library/Sounds/Basso.aiff |
OlderNewer