Skip to content

Instantly share code, notes, and snippets.

View chris-rock's full-sized avatar

Christoph Hartmann chris-rock

View GitHub Profile
@chris-rock
chris-rock / nodejs.sh
Last active December 28, 2015 01:39
nodejs quick installation for ubuntu
# run via
# curl https://gist.github.com/chris-rock/7422367/raw/5e55945ec3c0fa16d87d987a8381246307bc1ce7/nodejs.sh | sudo bash
echo "install preconditions"
apt-get update
apt-get install -y python-software-properties python g++ make
# for ubuntu quantal
apt-get install -y software-properties-common
@chris-rock
chris-rock / gist:7543290
Created November 19, 2013 10:22
mysql dump import
# mysql dump import
mysql -u root -p -h localhost
mysql> create database dbname;
mysql -u root -p -h localhost dbname < dbdump.sql
@chris-rock
chris-rock / onelinenodejs
Created November 22, 2013 11:24
oneliner nodejs installation
apt-get update && apt-get install -y python-software-properties python g++ make && add-apt-repository -y ppa:chris-lea/node.js && apt-get update && apt-get install -y nodejs
@chris-rock
chris-rock / aes_nodejs
Created November 24, 2013 15:48
encrypt and decrypt data with nodejs
"use strict";
var assert = require('assert');
var crypto = require('crypto');
var Buffer = require('buffer').Buffer;
var SECRET_KEY = "ChuckN0rrisL1kesPur3D3PapaSuperKey";
var ENCODING = 'hex';
//var ALGORITHM = "des-ede3-cbc";
var ALGORITHM = "aes256";
@chris-rock
chris-rock / logstash_forwarder_build
Created December 29, 2013 17:51
Build the logstash-forwarder via Docker Further information is available here: https://github.com/elasticsearch/logstash-forwarder
FROM ubuntu:precise
MAINTAINER Christoph Hartmann "chris@lollyrock.com"
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# compile logstash forwarder
RUN apt-get install -y wget git
RUN wget --no-check-certificate https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.1.1.linux-amd64.tar.gz
@chris-rock
chris-rock / gist:8806414
Created February 4, 2014 15:58
Delete file from git history
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -- file/*.txt' --prune-empty -- --all
@chris-rock
chris-rock / mp3-2-mp4.sh
Created April 20, 2014 15:13
Convert mp4 to mp3
for i in *.mp4; do ffmpeg -i $i -q:a 0 -map a mp3/$i.mp3; done
@chris-rock
chris-rock / gist:b25cebe1c56d2623b479
Created May 13, 2014 08:53
Filter empty git commits
git filter-branch --commit-filter 'git_commit_non_empty_tree "$@"' HEAD
@chris-rock
chris-rock / download.sh
Created July 6, 2014 11:42
Export Github issues
# download the first 100 items
# if you need more, change the page
http https://api.github.com/repos/:user/:repo/issues\?state\=all\&page\=4\&per_page\=100 'Content-Type:application/json' 'Authorization:token yourtoken' > backup01.json
@chris-rock
chris-rock / BearerStrategy.scala
Last active December 11, 2017 18:42
Scalatra Bearer Authentication
package com.lollyrock.auth
import java.util.Locale
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import com.sun.jersey.core.util.Base64
import org.scalatra.auth.strategy.{BasicAuthStrategy, BasicAuthSupport}
import org.scalatra.auth.{ScentryStrategy, ScentrySupport, ScentryConfig}
import org.scalatra.{Unauthorized, ScalatraBase}