Skip to content

Instantly share code, notes, and snippets.

View rogiervandenberg's full-sized avatar

Rogier van den Berg rogiervandenberg

View GitHub Profile
@rogiervandenberg
rogiervandenberg / convert.sh
Created January 2, 2021 20:07 — forked from bittercoder/convert.sh
Convert .heic files to .jpg on linux (coming from an iOS11 device over USB)
# download release from github: https://github.com/monostream/tifig/releases and install at ~/tools/tifig
# then run these commands in the folder (just to keep things simple we normalize the file extension case before proceeding).
for f in *.HEIC; do mv "$f" "`echo $f | sed s/.HEIC/.heic/`"; done
for file in *.heic; do echo "~/tools/tifig -v -p $file ${file/%.heic/.jpg}"; done
@rogiervandenberg
rogiervandenberg / main.go
Created October 5, 2020 13:13
Basis Golang HTTP REST server - Best practices interpreted
/*
Based on the video's and blogposts of Mat Ryer (@matryer)..
- https://pace.dev/blog/2018/05/09/how-I-write-http-services-after-eight-years.html
- https://www.youtube.com/watch?v=FkPqqakDeRY
- https://www.youtube.com/watch?v=rWBSMsLG8po
.. I derived the following starting point for a GO HTTP REST server. It can be used to add all explained (see above) concepts.
You could spread the code below in separate files as follows:
@rogiervandenberg
rogiervandenberg / readme.md
Last active July 22, 2019 08:13
Start Docker based Rails 6 project with Docker, without installing Ruby and/or Rails

Create new Rails 6 project with Docker

If you want to set-up a new Rails (6) project, but you don't want to go through the hassle of setting op Ruby, node, Yarn, Rails itself, etc. you could do it with Docker.

Setup

Prerequisite: Have Docker installed

If not, install Docker first

Create the directory for your project

Open a terminal, create a project folder somewhere and go into that directory:

@rogiervandenberg
rogiervandenberg / cloudSettings
Last active February 18, 2022 08:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-02-18T08:58:36.142Z","extensionVersion":"v3.4.3"}
@rogiervandenberg
rogiervandenberg / keybase.md
Created August 4, 2016 15:06
Keybase Proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@rogiervandenberg
rogiervandenberg / resque_on_heroku_rails4.md
Last active July 11, 2016 07:56
Setup Resque with Rails 4 on Heroku and locally

Setup Resque on Heroku for Rails 4

Resque depends on Redis, so first install Redis locally to be able to work on your project...

Install Redis locally on Mac

To install Redis locally, use the following approach on Mac OS X (using Homebrew). $ brew install redis

To test your install, firstly ensure that the Redis server is running. $ redis-server

@rogiervandenberg
rogiervandenberg / gmail_to_omnifocus.js
Last active March 23, 2016 11:09
Bookmarklet to make a link in Omnifocus to the current Gmail e-mail. The body of the mail is added as note, when hightlighting text in the e-mail only that part is added as note. There is always a link included to the original e-mail.
javascript:(function(){var enc=encodeURIComponent,w=window,frames=w.frames,d=document,tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pu=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),tt=pt=d.title,subjSpans=d.getElementsByClassName("hP"),i,url;if(isGMail){if(subjSpans){tt=subjSpans[0].innerText}else{tt=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^ +/,"").replace(/ +$/,"")};if(tn!="")tn+="\n\n";tn+="From email subject:("+tt+")\n"+pu;pu="https://mail.google.com/mail/u/0/?qs=true&search=query&q=subject:("+enc(tt)+")"};url='omnifocus:///add?note='+enc(tn+"\n"+pu)+'&name='+enc(tt);w.location.href=url})();
Verifying that +rogiervandenberg is my blockchain ID. https://onename.com/rogiervandenberg
@rogiervandenberg
rogiervandenberg / getLocalTimeStamp.js
Created November 18, 2015 11:05
Returns a timestamp corrected for the current timezone, instead of getting the UTC timezone. This can be useful for tracking timed-events in the perception of a user/visitor of your application/website in e.g. Google Tag Manager.
function getLocalTimeStamp () {
var currentDate = new Date();
var currentTime = currentDate.getTime();
var localOffset = (-1) * currentDate.getTimezoneOffset() * 60000;
var stamp = Math.round(new Date(currentTime + localOffset).getTime() / 1000);
return stamp;
}
@rogiervandenberg
rogiervandenberg / FrontdoorSensorReedSensor.ino
Created April 21, 2015 16:41
Checks my front door status. Sends status over RF-communication.
//To make more serial ports
#include <SoftwareSerial.h>
SoftwareSerial remoteSerial(2, 3); //Use pins 2 and 3 to connect the Serial connection
const int light = 13; //output and light
const int reedPin = 5; //read info from the Reed
//vars
int output = LOW;