Skip to content

Instantly share code, notes, and snippets.

View dylanbr's full-sized avatar

Dylan Bridgman dylanbr

View GitHub Profile
# Install requirements on MacOS (MacPorts)
sudo port install docker docker-machine
# Setup remote machine (eg. Digitalocean)
# Other drivers: https://docs.docker.com/machine/drivers/
docker-machine create --driver digitalocean --digitalocean-access-token=<your-token> --digitalocean-region=lon1 desktops
# Or for a local setup: https://apple.stackexchange.com/questions/373888/how-do-i-start-the-docker-daemon-on-macos
#docker-machine create --driver=virtualbox default
@dylanbr
dylanbr / index.js
Created July 17, 2019 08:47
Node 12 worker threads
// To run: node --no-warnings --experimental-modules index.js
import {
Worker,
isMainThread,
parentPort,
workerData,
} from 'worker_threads';
import { basename } from 'path';
import { fileURLToPath } from 'url';
@dylanbr
dylanbr / fizzbuzz.php
Last active October 2, 2020 14:11
Fizzbuzz in PHP
<?php
define(i,true+true);define(j,true+false);$d=i;$d++;$q=ceil("$d$d.$d"*$d);$n=[];$e=floor($d+"$d.$d")-true;define(d,$d);define(e,$e);
define(f,join("",array_map(function($v){return chr($v);},str_split(false+false.(bcmul(d.(i<<i).d*d.(i<<j)."7".i.d*d.str_repeat(@(g+g),sizeof(e)<<true)."678".true."4${e}".(@(g+g)).d*d."${e}1229",d**(i)<<sizeof(d))),3))));
ob_start(function($s) {return str_replace([a,b,c],str_split(f,4)+[d=>PHP_EOL],$s);});
while(@strlen($n)<$d&&sizeof($n)<$q){$n[]=rand();}
$q=array_map(function($v){return $v%(e*d)?$v%e?$v%d?$v:b:a:ba;},array_map(function($v) {return ++$v;},array_keys($n)));
echo join(c,$q).c;
@dylanbr
dylanbr / plugin_manager_manager.vim
Created November 9, 2018 09:12
Plugin manager manager for Vim
" Initialise plugins {{{
set nocompatible
" Install your preferred manager
" vundle: git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" vim-plug: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" minpac: git clone https://github.com/k-takata/minpac.git ~/.vim/pack/minpac/opt/minpac
"
" Install/update/clean your packages
" vundle :PluginInstall / :PluginUpdate / :PluginClean
@dylanbr
dylanbr / gist:893de8a076cce5165131
Last active August 29, 2015 14:14
"hello world!" from prime numbers in JavaScript (formatted)
function greet() {
return
m=-2,
r=5,
x=1311298913,
y=6610866907,
z=Math.pow(r+m,r+m),
l=[]+[],
g=l+greet,
(x*z*r*-m+l+y*(z*r+-m*r)).match(/\d{2}/g).map(function(e){
@dylanbr
dylanbr / gist:04bf0aa18709bad4cf21
Created January 24, 2015 16:08
"hello world!" from prime numbers using JavaScript
function greet() {
return m=-2,r=5,x=1311298913,y=6610866907,z=Math.pow(r+m,r+m),l=[]+[],g=l+greet,(x*z*r*-m+l+y*(z*r+-m*r)).match(/\d{2}/g).map(function(e){m=-m;return this[e/r+m];},g.replace(/[^^-{ !]/g,l).split(l).sort().filter(function(e,i,a){return a.indexOf(e,++i)===-1;}).join(l)).join(l);
}