Skip to content

Instantly share code, notes, and snippets.

Christoph Champ christophchamp

Block or report user

Report or block christophchamp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View find_category.py
#!/usr/bin/env python
import yaml
import json
"""
DESCRIPTION: The goal of this script is to find the outermost/top-level key in
the following YAML document, given only the sub-group/sub-key name.
EXAMPLE: Say you only know the sub-group "mars" or "pluto", and you want to
know which top-level key they belong to (i.e., "apps" and "services",
respectively). The find_category() function will do just that, albeit, very
View heads_and_tails_game.py
#!/usr/bin/env python
from random import randint
RANGE = 1000000
def random_guess(RANGE):
wins = []
for _ in range(0, RANGE):
guess = randint(0, 1)
outcome = randint(0, 1)
View tomcat.sh
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@christophchamp
christophchamp / Vagrantfile
Created Jun 28, 2016
Spin up multiple Vagrant VMs
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
$common_script = <<COMMON_SCRIPT
# Set verbose
set -v
# Set exit on error
@christophchamp
christophchamp / aws-cloudformation-lamp-stack.json
Created May 10, 2016
AWS CloudFormation single instance LAMP stack template
View aws-cloudformation-lamp-stack.json
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template LAMP_Single_Instance: Create a LAMP stack using a single EC2 instance and a local MySQL database for storage. This template demonstrates using the AWS CloudFormation bootstrap scripts to install the packages and files necessary to deploy the Apache web server, PHP and MySQL at instance launch time. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "AWS::EC2::KeyPair::KeyName",
View gist:8e086f73c148510c0fc6
# Steganography trick:
$ cat foo.zip >> bar.gif # "hides" 'foo.zip' inside 'bar.gif'
$ qiv bar.gif # views just fine (note: you can use any image viewer you like here)
$ unzip bar.gif # extracts 'foo.zip'
# Example:
$ echo "HELLO WORLD" > file.txt
$ zip -r foo.zip file.txt
$ cat foo.zip >> bar.gif
$ hexdump -C bar.gif |tail -12
View rename_yt.sh
# Rename:
# FROM: "Introduction___Networking_tutorial_(1_of_13)-qHzZUmP1vvON.mp4"
# TO: "nettut-01_of_13_-_Introduction-qHzZUmP1vvON.mp4"
for f in *.mp4; do \
[[ $f =~ ^(.*)___Networking_tutorial_\(([0-9]+)_of_13\)-(.*)$ ]]
mv "$f" "nettut-$(printf "%02d" ${BASH_REMATCH[2]})_of_13_-_${BASH_REMATCH[1]}-${BASH_REMATCH[3]}"
done
@christophchamp
christophchamp / trove.bash_completion
Created Jun 18, 2015
Bash completion for `trove` (OpenStack DBaaS API)
View trove.bash_completion
_trove()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "--configuration --marker database-list metadata-show secgroup-delete-rule cluster-delete user-revoke-access root-show --users database-delete --limit datastore-show configuration-detach backup-list user-grant-access help configuration-list delete --region --replica_of metadata-update create show -h cluster-show user-create --include-clustered configuration-create restart configuration-default metadata-list --backup --detach-replica-source user-update-attributes --new_password metadata-edit configuration-parameter-show backup-show --new_host flavor-show datastore-list configuration-instances --databases list --description root-enable secgroup-list-rules configuration-patch metadata-create resize-flavor --help cluster-list --remove_configuration --collate user-list datastore-version-list --instance cluster-instances cluster-create database-create secgroup-add-rule --datastore configuration-update configuration-parameter-list secgro
View cors-nginx.conf
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
View keybase.md

Keybase proof

I hereby claim:

  • I am christophchamp on github.
  • I am xtof (https://keybase.io/xtof) on keybase.
  • I have a public key whose fingerprint is 8D0A 5408 3B16 7656 6B65 EBAC 26D5 622E 8B70 5E64

To claim this, I am signing this object:

You can’t perform that action at this time.