Skip to content

Instantly share code, notes, and snippets.

@goliatone
goliatone / _README.md
Created June 6, 2017 13:35 — forked from schickling/_README.md
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@goliatone
goliatone / auto_nvm_use.sh
Created June 5, 2017 16:46 — forked from sndrs/auto_nvm_use.sh
Automatically set node version per project using .nvmrc file
# This will run `nvm use` everytime you change directory, if
# 1. an .nvmrc file is present
# 2. there is no .nvmrc but you're not using your default node
# Add it to your `.bash_profile` (or wherever else is suitable for your setup).
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;
@goliatone
goliatone / ClassA.swift
Created March 28, 2017 21:24 — forked from MarcoMig/ClassA.swift
Swift: Async callback block pattern example
//ClassA it's the owner of the callback, he will trigger the callback when it's the time
class ClassA {
//The property of that will be associated to the ClassB callback
var callbackBlock : ((error : NSError?, message : String?, adress : String? ) -> Void)?
init() {
//Do Your staff
}
//Define your function with the clousure as a parameter
@goliatone
goliatone / proxy.go
Created March 27, 2017 13:56 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"

Since git allows you to run scripts as if they were git commands, this will show how to create a command for creating a pull request from the terminal.

  1. Create a file with the following name "git-pull-request", we can put it inside ~/.git/extensions for instance. Add the following content to the file
#!/usr/local/bin/bash

repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
#!/bin/bash
# https://github.com/adriancooney/Taskfile
#Include npm installed binaries so we can call those
#directly from the taskfile.
PATH=./node_modules/.bin:$PATH
# You could aliase taskfiles so you
# can run them like: run <task>
# echo alias run=./taskfile > .bashrc
@goliatone
goliatone / index.js
Created February 18, 2017 20:37 — forked from Torsten85/index.js
JohnnyFive / chip-io / oled
var five = require('johnny-five');
var Chip = require('chip-io');
var Oled = require('oled-js');
var io = new Chip();
io.i2cConfig({
address: 0x3c,
bus: 2
@goliatone
goliatone / README.md
Created February 10, 2017 21:27 — forked from escapedcat/README.md
Tutorial: Cordova iOS build with fastlane, match and Jenkins

Cordova CI with Jenkins for iOS apps

Inspired by CI server on Mac OS for iOS using GitLab and Fastlane by @v_shevchyk we decided to write down our approach. This will be extended and improved over time.

So you want to deploy your Cordova app, but you hate opening xcode manually to archive and export and sign and cry? Try this. By this we mean we try to explain how to create the following CI (Jenkins) setup:

  • Build Cordova app
  • Create & sign your ipa file
  • Upload to HockeyApp (for Enterprise distribution)
@goliatone
goliatone / repeat_charactar.js
Created January 9, 2017 16:33
repeat a character a number of times
function repeat(char, times){
return Array(times + 1).join(char);
}
@goliatone
goliatone / get_facility_code_wiegan_length_from_format_name.js
Last active November 7, 2017 19:21
Calculate parity bit for a string representation of a binary number, i.e 0101011101
var FACILITY_CODE = /(\d+)$/;
var WIEGAND_LENGTH = /^Wiegand (\d+)/i;
function getFacilityCode(format=''){
let match = format.match(FACILITY_CODE);
if(!match) return undefined;
let code = match[1];
return parseInt(code);
}