NOTE: Do not use self signed certificates in PRODUCTION, for that use a certificate signed by some CA (Certification Authority), and then avoid man-in-the-middle attack.
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 logging | |
from http.client import HTTPConnection | |
log = logging.getLogger('urllib3') | |
log.setLevel(logging.DEBUG) | |
# logging from urllib3 to console | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) | |
log.addHandler(ch) |
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 | |
# | |
# Inspects branch name and checks if it contains a Jira ticket number (i.e. ABC-123). | |
# If yes, commit message will be automatically prepended with [ABC-123]. | |
# | |
# Useful for looking through git history and relating a commit or group of commits | |
# back to a user story. | |
# Thanks to https://medium.com/bytelimes/automate-issue-numbers-in-git-commit-messages-2790ae6fe071 |
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
(defun divisible (a b) | |
(equal 0 (% a b))) | |
(defun to_s (item) (format "%s" item)) | |
(defun fizzbuzz (num) | |
(let* ((fizz (if (divisible num 3) "fizz" "")) | |
(buzz (if (divisible num 5) "buzz" "")) | |
(combi (concat fizz buzz)) | |
(result (if (length> combi 0) combi (to_s num)))) |
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
-- ███████╗███╗░░░███╗░█████╗░░█████╗░░██████╗ | |
-- ██╔════╝████╗░████║██╔══██╗██╔══██╗██╔════╝ | |
-- █████╗░░██╔████╔██║███████║██║░░╚═╝╚█████╗░ | |
-- ██╔══╝░░██║╚██╔╝██║██╔══██║██║░░██╗░╚═══██╗ | |
-- ███████╗██║░╚═╝░██║██║░░██║╚█████╔╝██████╔╝ | |
-- ╚══════╝╚═╝░░░░░╚═╝╚═╝░░╚═╝░╚════╝░╚═════╝░ | |
-- | |
-- Open this script with 'Script Editor' on MacOS, then save it | |
-- inside /Applications as an 'Application', not 'Script'. |
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
# Just a copy of https://stackoverflow.com/a/30724359/1825727 | |
def from_hashstring(value) | |
json_string = value | |
.gsub(/([{,]\s*):([^>\s]+)\s*=>/, '\1"\2"=>') # Handle ruby symbols as keys | |
.gsub(/([{,]\s*)([0-9]+\.?[0-9]*)\s*=>/, '\1"\2"=>') # Handle numbers as keys | |
.gsub(/([{,]\s*)(".+?"|[0-9]+\.?[0-9]*)\s*=>\s*:([^,}\s]+\s*)/, '\1\2=>"\3"') # Handle symbols as values | |
.gsub(/([\[,]\s*):([^,\]\s]+)/, '\1"\2"') # Handle symbols in arrays | |
.gsub(/([{,]\s*)(".+?"|[0-9]+\.?[0-9]*)\s*=>/, '\1\2:') # Finally, convert => to : | |
JSON.parse(json_string) |
I hereby claim:
- I am akagr on github.
- I am akashagrawal (https://keybase.io/akashagrawal) on keybase.
- I have a public key ASB2jpNzAa37164ZMfrGb0Te3fV4rcXowwYbpKIG-AeTwwo
To claim this, I am signing this object:
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
# To get the resolution, multiply 118 by cm. For example, 7 cm image at 300ppi will be 7 * 118 = 826 px | |
RESOLUTION=826 | |
convert $1 -resize ${RESOLUTION}x${RESOLUTION}^ -gravity center -crop ${RESOLUTION}x${RESOLUTION}+0+0 +repage -blur 0x8 temp.jpg | |
convert temp.jpg $1 -resize ${RESOLUTION}x -gravity center -composite -matte "./output/$1-out.jpg" |
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
openssl genrsa -des3 -out config/topbox-ca-key.pem 1024 | |
openssl req -new -key config/topbox-ca-key.pem -out config/topbox-ca.pem | |
openssl x509 -req -days 365 -in config/topbox-ca.pem -out config/topbox-ca-csr.pem -signkey config/topbox-ca-key.pem | |
openssl genrsa -des3 -out config/topbox-key.pem 1024 | |
openssl req -new -key config/topbox-key.pem -out config/topbox-csr.pem | |
cp config/topbox-key.pem config/server.key.org | |
openssl rsa -in config/server.key.org -out config/topbox-key.pem | |
rm config/server.key.org |
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
'Twas the night before implementation and all through the house, | |
not a program was working not even a browse. | |
The programmers hung by their tubes in despair, | |
with hopes that a miracle would soon be there. | |
The users were nestled all snug in their beds, | |
while visions of inquiries danced in their heads. | |
When out in the machine room there arose such a clatter, | |
I sprang from my desk to see what was the matter. |
NewerOlder