Skip to content

Instantly share code, notes, and snippets.

View fvosberg's full-sized avatar

Frederik Vosberg fvosberg

View GitHub Profile
@fvosberg
fvosberg / Dockerfile
Created July 12, 2020 12:22
Dockerfile for go apps with the ability to bind to port 80
# Go build
FROM golang:1.14 as build-go
ARG BUILD_TAG
ARG BUILD_DATE
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOOS=linux
ENV GOPATH=/
@fvosberg
fvosberg / .gitlab-ci.yml
Created March 10, 2020 08:09
.gitlab-ci GIT submodule check
variables:
GIT_SUBMODULE_STRATEGY: recursive
check_submodule_updates:
stage: test
# a warning is sufficient for this check, it should not prevent a deployment
allow_failure: true
script:
- cd path-to-submodule
- git fetch origin

Keybase proof

I hereby claim:

  • I am fvosberg on github.
  • I am fvosberg (https://keybase.io/fvosberg) on keybase.
  • I have a public key ASD1sn8Pv6Nl9lpnTNk55yslv8Jrnud-BTBzHURnKpNHlgo

To claim this, I am signing this object:

@fvosberg
fvosberg / list_slicing_read.py
Created July 26, 2017 17:14
list slicing read
#!/usr/local/bin/python3.6
import random
random.seed()
l = [x + 1 for x in range(random.randint(3,8))]
nParams = random.randint(1,3)
print("l = ", l)
@fvosberg
fvosberg / headline.py
Created July 21, 2017 05:13
Trying to find a nice and clean solution in python with currying
#!/usr/local/bin/python3.6
def init_hr():
number = 0
def inner():
nonlocal number
number += 1
print("============================================================================")
print("============================== UEBUNG ", number, "===================================")
print("============================================================================")
@fvosberg
fvosberg / install-composer.sh
Created April 19, 2016 20:24
Install composer oneliner for bash with curl
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@fvosberg
fvosberg / ssh-agent.sh
Created March 17, 2016 11:56
Start SSH-Agent
eval `ssh-agent` # or
exec ssh-agent bash
ssh-add
@fvosberg
fvosberg / jquery-wrapper.js
Created March 9, 2016 11:09
Wrapper for jquery functions
function executeWithJquery(callback) {
(function($){
if(!$) {
if(typeof console === 'object') {
console.log('This plugin requires jQuery.');
}
return;
}
callback();
})((typeof jQuery !== "undefined" ? jQuery : null));
@fvosberg
fvosberg / Gulpfile.js
Created January 25, 2016 21:10
Gulpfile for phpunit in composer project
var gulp = require('gulp');
var exec = require('child_process').exec;
var path = require('path');
var fs = require('fs');
gulp.task('phpunit', function() {
var class_file_to_test_file = function(class_path) {
var test_file = class_path.replace(/\/Classes\//g, '/Tests/Unit/');
return test_file.slice(0, -4) + 'Test.php';
};
@fvosberg
fvosberg / memory_usage.php
Created December 29, 2015 14:42
Display memory usage
$size = memory_get_usage(TRUE);
$unit = array('b','kb','mb','gb','tb','pb');
$mem = @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];