Skip to content

Instantly share code, notes, and snippets.

View loa's full-sized avatar

Carl Loa Odin loa

  • NoneType AB
  • Stockholm
View GitHub Profile
# install on osx with brew
brew install ipmitool
# list all sensors with values and thresholds
ipmitool -H 192.168.0.1 sensor
# Set lower thresholds for FAN1 (thresh <id> lower <lnr> <lcr> <lnc>)
ipmitool -H 192.168.0.1 sensor thresh FAN1 lower 300 300 300
@loa
loa / init.vim
Created March 3, 2016 18:34
Neovim config
call plug#begin('~/.nvim/plugged')
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Shougo/neocomplcache.vim'
Plug 'scrooloose/syntastic'
Plug 'airblade/vim-gitgutter'
Plug 'spolu/dwm.vim'
Plug 'kien/ctrlp.vim'
@loa
loa / golang-docker-directly.go
Created September 29, 2015 06:17
Golang docker directly
// $ go run golang-docker-directly.go && docker run -it --rm golang-docker-directly
package main
import (
"archive/tar"
"bytes"
"fmt"
"log"
"os/exec"
)
@loa
loa / repsonse.json
Last active September 17, 2015 07:04
Plan times
{
"plans": [
{"time": 156}
]
}
@loa
loa / verify-head-not-release.sh
Created July 17, 2015 09:06
Bash verify Git Head is not tagged release
#!/bin/bash
git tag --contains HEAD | grep -q "v.*" && {
echo "HEAD is already tagged release."
} || {
echo "HEAD is not a tagged release."
}
@loa
loa / build-on-version-tag.yaml
Last active August 29, 2015 14:21
Trigger Jenkins job on version tag
- job:
name: 'release-application'
defaults: defaults
scm:
- git:
url: 'ssh://jenkins@gerrit:29418/application'
refspec: '+refs/tags/*:refs/remotes/origin/tags/*'
branches:
- 'refs/tags/v*'
@loa
loa / Dockerfile
Last active August 29, 2015 14:18
Dockerfile download hashsum install
FROM debian:wheezy
ENV RIAKCS_DOWNLOAD_SHA1=caae1342618958fc9c1bc7e79a8596ca27866b3a
ENV RIAKCS_DOWNLOAD_URL=http://s3.amazonaws.com/downloads.basho.com/riak-cs/2.0/2.0.0/debian/7/riak-cs_2.0.0-1_amd64.deb
RUN buildDeps='curl gdebi-core'; \
set -x \
&& apt-get update \
&& apt-get install -y $buildDeps --no-install-recommends \
&& curl -sSL "$RIAKCS_DOWNLOAD_URL" -o riakcs.deb \
@loa
loa / verify-head-not-release.py
Created February 26, 2015 15:08
Python verify Git Head is not tagged release
#!/usr/bin/env python
import sys
import re
import subprocess
# Make sure HEAD is not a release
gitdescribe = subprocess.check_output('git describe', shell=True)
release_pattern = re.compile(r"^(v|)\d+\.\d+\.\d+$")
@loa
loa / hipchat.sh
Created February 23, 2015 13:51
Hipchat Message api v2
#!/bin/bash
# https://gist.github.com/danriti/7345074
ROOM_ID=1
MESSAGE="$(hostname): $1"
AUTH_TOKEN="secret"
curl -H "Content-Type: application/json" \
-X POST \
--silent \
@loa
loa / gitlab_restart_background_jobs.sh
Created February 23, 2015 13:49
Gitlab Sidekiq Zombie Apocalypse Crontab Sentry
#/bin/bash +xe
exec 1> >(logger -s -t $0) 2>&1
# Load RVM into a shell session *as a function*
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
num_zombies=$(ps aux | grep defunct | grep -v grep | wc -l)
[ ${num_zombies} -eq 0 ] && {