Skip to content

Instantly share code, notes, and snippets.

Avatar

Oskar Maria Grande musha68k

  • daruma.io
  • Montréal
View GitHub Profile
@musha68k
musha68k / list_ops.ml
Last active Apr 2, 2017
List operations
View list_ops.ml
let rec fold ~init ~f = function
[] -> init
| x :: xs -> fold ~init:(f init x) ~f xs
let length xs =
xs
|> fold ~init:0 ~f:(fun acc _ -> acc + 1)
let reverse xs =
xs
@musha68k
musha68k / vcard_converter.rb
Created Feb 12, 2016
Converts multiple single person 2.1 vcard files from a Nokia dumb-phone export (".vcf") into one iCloud web contacts importable vcards collection file
View vcard_converter.rb
#!/usr/bin/env ruby
require 'vpim'
require 'vcardio'
files = Dir.glob "*.vcf"
vcards = files.map do |f|
vc_old = Vpim::Vcard.decode(File.read(f))[0]
# proper vcard 4.0 wasn't accepted by the iCLoud web-interface
View keybase.md

Keybase proof

I hereby claim:

  • I am musha68k on github.
  • I am musha68k (https://keybase.io/musha68k) on keybase.
  • I have a public key whose fingerprint is 3AC3 9645 FDE9 3C57 6A42 451A 56DA C4A3 1372 6D99

To claim this, I am signing this object:

@musha68k
musha68k / docker_based_development_on_osx.md
Last active Jan 13, 2016
Docker based development on OSX
View docker_based_development_on_osx.md

Premise

  1. our base operating system is Mac OSX which we will simply call osx

  2. on top of osx we run a hypervisor (e.g. xhyve, vmware, virtualbox)

  3. on top of our hypervisor we are running a virtual machine with CoreOS as our docker_engine (with the help of or without vagrant)

  4. on top of our docker_engine we run an arbitrary set of docker_container instances most of which are comprised of a "bespoke" docker_image of our own; a certain "microservice" in development

@musha68k
musha68k / init.coffee
Last active Nov 28, 2015 — forked from dustinblackman/init.coffee
Load env variables from ZSH for Atom
View init.coffee
# the shotgun way..
exec = require('child_process').exec
exec('source ~/.zshrc')
@musha68k
musha68k / alias_osx_notification_center.txt
Last active Nov 28, 2015
Alias for OSX Notification Center notification
View alias_osx_notification_center.txt
```
notify_me() {
osascript -e "display notification \"$1\" with title \"$2\""
}
alias notify_me=notify_me
```
@musha68k
musha68k / vagrant_with_docker_engine.txt
Last active Nov 28, 2015
Vagrant with Docker Engine
View vagrant_with_docker_engine.txt
We need a Docker container engine which will enable us to run docker containers on OSX.
So the first step to get there is to create a Vagrant virtual machine image with the provider of your choice.
Vagrantfile:
```
Vagrant.configure(2) do |config|
config.vm.box = 'ubuntu/trusty64'
@musha68k
musha68k / set_current_date_on_all_vagrant_instances.md
Last active Sep 27, 2018
Set system dates for all running vagrant instances like a savage (🔨👈)
View set_current_date_on_all_vagrant_instances.md

How to fix skewed system times on multiple vagrant instances 🍻

Set current date of darwin/osx on all local vagrant instances:

date | pbcopy && vagrant status | grep running | awk '{print $1}' | xargs -I {} vagrant ssh {} -c "sudo date --s \"$(pbpaste)\""

Set current date of darwin/osx on all vagrant instances:

date | pbcopy && vagrant global-status | grep running | awk '{print $1}' | xargs -I {} vagrant ssh {} -c "sudo date --s \"$(pbpaste)\""
View 0 Himawari Scraper
Example: https://denpa.moe/~syrup/himawari8.png
View gist:603272
var a = function(){
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);