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:
require 'optparse' | |
require 'optparse/time' | |
require 'ostruct' | |
require 'pp' | |
class OptparseExample | |
CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary] | |
CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" } |
# The Expires* directives requires the Apache module `mod_expires` to be enabled. | |
<Location /assets/> | |
# Use of ETag is discouraged when Last-Modified is present | |
Header unset ETag | |
FileETag None | |
# RFC says only cache for 1 year | |
ExpiresActive On | |
ExpiresDefault "access plus 1 year" | |
</Location> |
var a = 5; | |
function runMe(a){ | |
assert( a == ___, "Check the value of a." ); | |
function innerRun(){ | |
assert( b == ___, "Check the value of b." ); | |
assert( c == ___, "Check the value of c." ); | |
} | |
var b = 7; |
# Find all files less than 2kb | |
find /path/to/directory -type f -size -2k | |
# Find all text files less than 2kb | |
find /path/to/directory -type f -name '*.txt' -size -2k | |
# Find all files with given pattern and count them | |
find -type f -name '*.jpg' | wc -l | |
find -type f -name 'e_*' | wc -l |
'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. |
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 |
# 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" |
I hereby claim:
To claim this, I am signing this object:
# 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) |
-- ███████╗███╗░░░███╗░█████╗░░█████╗░░██████╗ | |
-- ██╔════╝████╗░████║██╔══██╗██╔══██╗██╔════╝ | |
-- █████╗░░██╔████╔██║███████║██║░░╚═╝╚█████╗░ | |
-- ██╔══╝░░██║╚██╔╝██║██╔══██║██║░░██╗░╚═══██╗ | |
-- ███████╗██║░╚═╝░██║██║░░██║╚█████╔╝██████╔╝ | |
-- ╚══════╝╚═╝░░░░░╚═╝╚═╝░░╚═╝░╚════╝░╚═════╝░ | |
-- | |
-- Open this script with 'Script Editor' on MacOS, then save it | |
-- inside /Applications as an 'Application', not 'Script'. |