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
const ARABIC_ROMAN_MAP = [ | |
["M", 1000], | |
["CM", 900], | |
["D", 500], | |
["CD", 400], | |
["C", 100], | |
["XC", 90], | |
["L", 50], | |
["XL", 40], | |
["X", 10], |
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
/* | |
//so far we've worked with some basic operators | |
Positive and negative operators (unary) | |
+ | |
- | |
Arithmetic (binary) | |
+ | |
- | |
/ | |
* |
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
curl https://dmitryshvetsov.com/sitemap.xml | \ | |
grep -e loc | \ | |
sed 's:<loc>\(.*\)<\/loc>$:\1:g' | \ | |
sed -e 's/^[[:space:]]*//' | \ | |
sed 's/https:\/\/dmitryshvetsov\.com/http:\/\/localhost:8000/' | \ | |
while read -r line; do open $line; done |
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
class Object | |
def if_true | |
yield | |
self | |
end | |
def if_false | |
self | |
end | |
end |
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
class Worker | |
def self.start(num_threads:, queue_size:) | |
queue = SizedQueue.new(queue_size) | |
worker = new(num_threads: num_threads, queue: queue) | |
worker.spawn_threads | |
worker | |
end | |
def initialize(num_threads:, queue:) | |
@num_threads = num_threads |
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
const ARABIC_ROMAN_MAP = [ | |
["M", 1000], | |
["CM", 900], | |
["D", 500], | |
["CD", 400], | |
["C", 100], | |
["XC", 90], | |
["L", 50], | |
["XL", 40], | |
["X", 10], |
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
insert into | |
trailing_spaces (value) | |
select | |
case | |
when mod(indx, 9) = 0 then 'A' || (random() * 100)::text || ' ' | |
when mod(indx, 10) = 0 then ' B' || (random() * 100)::text | |
else 'C' || (random() * 100)::text | |
end | |
from | |
generate_series(1, 1000000) as d (indx) |
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
{ | |
"indentRainbow.colors": [ | |
"rgba(46,52,64,0.5)", | |
"rgba(59,66,82,0.5)", | |
"rgba(67,76,94,0.5)", | |
"rgba(76,86,106,0.5)", | |
"rgba(87,98,121,0.4)", | |
"rgba(97,110,136,0.3)", | |
"rgba(109,122,150,0.2)", | |
] |
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 -e | |
ssh -q git@github.com | true | |
if [ $? -eq 0 ]; then | |
echo "SSH to github OK" | |
else | |
echo "Cannot connect to github via SSH. Are you added your SSH key to your github account?" | |
exit | |
fi |
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 | |
# Generate self signed root CA cert | |
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com" | |
# Generate server cert to be signed | |
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com" | |
# Sign the server cert |