Skip to content

Instantly share code, notes, and snippets.

View PI-Victor's full-sized avatar
🏗️
All that is gold does not glitter, Not all those who wander are lost

Victor Palade PI-Victor

🏗️
All that is gold does not glitter, Not all those who wander are lost
View GitHub Profile
#!/usr/bin/env bash
GIT="/usr/bin/git"
EMACS="~/.emacs.d/"
#check if i have the emacs.d folder already
if [ -d "$EMACS" ]; then
echo ".emacs.d folder already present in home folder, remove it first, then retry"
fi
#do we have git, if so clone repo and copy .emacs to home folder
if [ -z "$GIT" ]; then
echo "You don't have git installed"
@PI-Victor
PI-Victor / golang-script
Last active August 29, 2015 14:15
golang compiler script for the makefile
#!/usr/bin/env bash
# source of inspiration was Docker's make file and install scripts
# https://github.com/docker/docker/blob/master/project/make.sh
# only tested on Centos 7 so far
ARG=$1
GOBIN="/usr/bin/go"
# all main entry points that need to be build will be
# nested in the cmd folder
@PI-Victor
PI-Victor / ip-finder
Created February 14, 2015 19:35
get the ip to which to bind
import socket
#get current ip to bind to
DEFAULTHOST = ([(s.connect(('8.8.8.8', 80)), s.getsockname()[0],
s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1])
for the mariadb official docker registry image to bind it to localhost:
sudo docker run -d --name mariadb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123123 mariadb
@PI-Victor
PI-Victor / pr.md
Last active November 7, 2016 13:34 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

http://ernestmicklei.com.s3-website-eu-west-1.amazonaws.com/2012/11/go-restful-api-design/
http://dukex.svbtle.com/manage-golang-dependencies
https://engineering.canva.com/2015/08/25/how-we-get-things-done/
https://apiblueprint.org/
http://www.gofpatterns.com/design-patterns/module3/intro-singleton-design-pattern.php
http://www.hydrogen18.com/blog/stop-listening-http-server-go.html
http://soryy.com/blog/2014/common-mistakes-with-go-lang/
https://howistart.org/posts/go/1
https://talks.golang.org/2013/bestpractices.slide#1
http://peter.bourgon.org/go-in-production/
@PI-Victor
PI-Victor / gist:631915dd7ee5c577faa6656368fb76e1
Created May 19, 2016 09:40
oc describe for failed ref matches on github webhook
Name: ruby-sample-build-3
Namespace: demo
Created: 10 seconds ago
Labels: app=ruby-sample-build
buildconfig=ruby-sample-build
name=ruby-sample-build
openshift.io/build-config.name=ruby-sample-build
openshift.io/build.start-policy=Serial
template=application-template-dockerbuild
Annotations: openshift.io/build-config.name=ruby-sample-build
@PI-Victor
PI-Victor / gist:dbf15ba42928266ce280be2f195ae505
Created May 25, 2016 13:57
CURL the github webhook of openshift to start a build
curl -kvX POST -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @/data/src/github.com/openshift/origin/pkg/build/webhook/github/fixtures/pushevent.json https://10.0.2.15:8443/oapi/v1/namespaces/demo/buildconfigs/centos/webhooks/f-A_pRLVKY5Y6ZfprEyf/github
apiVersion: v1
items:
- apiVersion: v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: 2016-07-27T11:37:08Z
labels:
app: test-javaee-app
@PI-Victor
PI-Victor / linux.sh
Created January 10, 2017 15:59 — forked from marcan/linux.sh
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name