- First:
- Find...
(?:ISODate|ObjectId)\(("[^"]+")\)
(BSON types) - And replace with...
$1
(the non-ignored capture group)
- Find...
- Second:
- Find...
(/\*\s+\d+\s+\*/)
(index comments) - And replace with...
,
(comma to separate array elements)
- Find...
- Finally
- Remove the stray comma where
/* 1 */
used to be
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 | |
ssh -L 5555:localhost:5432 vagrant@localhost -p 2222 -i ~/.vagrant.d/insecure_private_key -fNg # local port 5555 <-> Vagrant port 5432 |
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/php56s -d register_argc_argv=1 "./composer.phar" install |
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 | |
# Generate a slideshow of images for cover art trivia. | |
# Files should be named like {SORT-NUMBER} blah blah blah.jpg | |
for f in *.jpg; do | |
num=$(echo $f | sed -En "s/^([0-9]+).+?/\1/p") | |
formatNum="$((10#$num + 1 - 1))" | |
output=final_$num.jpg | |
echo "Processing $f file..."; |
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 argv = require('yargs').argv; | |
let sieve = {}; | |
let timeAtStart; | |
// like a boss | |
Object.prototype.commafy = function () { | |
return this.toString().replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) { | |
return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,"); | |
}); |
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
dsmith@pop-os ~/code/other/sandbox/sieve (master) $ yarn start --check 10 | |
yarn run v1.21.1 | |
$ node index.js --check 10 | |
Primes between 1 and 10 WITH sieve: | |
3 primes! | |
0.00 second(s) elapsed | |
----------------------------------------------------------------- | |
Counting primes between 1 and 10 WITHOUT sieve: | |
3 primes! | |
0.00 second(s) elapsed |
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
du -hs * | sort -h | tail -n 25 | sort -h -r |
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 DLs = []; | |
$('a[href*="download/"]').each((i, a) => { | |
const $a = $(a); | |
DLs.push('bcdl \'' + $a.attr('href') + '\''); | |
}); | |
console.log(DLs.join("\n")); | |
})(); |
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 scalarTypes = ['string', 'number', 'boolean', 'date']; | |
const isScalar = thing => scalarTypes.indexOf(typeof thing) >= 0; | |
const detSerConvert = (inp) => { | |
if (inp instanceof Date) { return inp.toISOString(); } | |
if (isScalar(inp)) { return inp; } | |
if (Array.isArray(inp)) { return inp.map(detSerConvert); } |
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
// Things used as keys must implement this | |
public interface Cacheable { | |
public abstract String cacheKey(); | |
} | |
// This is the cache wrapper (it would get an injected CacheManager to use internally) | |
public abstract class GenericCacheableCache<K extends Cacheable, V> { | |
private CacheManager cache; | |
public Optional<V> get(K key) { |