Skip to content

Instantly share code, notes, and snippets.

Stefan Oderbolz metaodi

View GitHub Profile
@metaodi
metaodi / outlier_iqr.sas
Created Sep 24, 2019
A SAS program to detect outliers using IQR (interquartile range)
View outlier_iqr.sas
/* Caluculate quartiles to get limits */
proc univariate data=work.ZaehlstelleZeit_&num. noprint;
var AnzFahrzeuge;
output out=work.ZaehlstelleStat_&num. p25=q1 p75=q3;
run;
data work.ZaehlstelleStat_&num.;
set work.ZaehlstelleStat_#
ZSID = "&name";
iqr = q3 - q1;
@metaodi
metaodi / examples.py
Last active Feb 5, 2016
Python Summit 2016
View examples.py
# Named regex groups
import re
sentence = "\"The Hitchhiker's Guide to the Galaxy\" was published in 1979"
regex = "\"([\w ']+)\" was published in (\S+)"
print "find_all: %s"%(re.findall(regex, sentence))
match = re.search("\"(?P<book>[\w ']+)\" was published in (?P<year>\S+)", sentence)
print "match groups: %s"%(str(match.groups()))
print "match group1: %s"%(str(match.group(1)))
View create_and_apply_dump.sh
# create a new DB dump
mysqldump -u USERNAME -p --skip-extended-insert --skip-quick DB_NAME > dump.sql
# replace the domain name in the dump, this is needed if you plan to use the dump on another domain
sed 's/www\.example\.com/stage.example.com/g' < dump.sql > updated_dump.sql
# optional: re-create the database
mysql -u root -e"show databases;" | grep DB_NAME && mysql -u root -e"drop database DB_NAME;"
mysql -u root -e"create database DB_NAME;"
@metaodi
metaodi / remove-text-rendering.user.js
Last active Nov 10, 2015
Remove text-rending to fix Chromium 45 bug
View remove-text-rendering.user.js
// ==UserScript==
// @name Remove text-rending to fix Chromium 45 bug
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://gitlab.liip.ch
// @grant none
// ==/UserScript==
/* jshint -W097 */
View tabs-to-spaces.user.js
// ==UserScript==
// @name Tabs to spaces for GitLab
// @namespace http://liip.ch/
// @version 0.1
// @description Fix tab bug of GitLab/Chromium 45 (https://gitlab.com/gitlab-org/gitlab-ce/issues/3220)
// @author Odi
// @match https://gitlab.liip.ch/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@metaodi
metaodi / gist:432f4988974240bad101
Created Jul 7, 2015
Story Point Count in Confluence when using the Jira macro
View gist:432f4988974240bad101
<div id="count-1"></div>
<script>
window.setTimeout(function() {
var sum = 0;
$('table:eq(0) tr[class^="row"]').each(function() {
storyPoint = jQuery(this).find("td:eq(4)");
value = parseInt(storyPoint.text());
if (! isNaN(value)) {
sum += value;
}
@metaodi
metaodi / vagrant-status
Created May 31, 2015
Status of all local vagrant boxes
View vagrant-status
#!/bin/bash
root_dir="$HOME"
if [ -n "$1" ] ; then
root_dir=$1
fi
for vdir in `find $root_dir -name .vagrant -type d 2>/dev/null`; do
cd $vdir
cd ..
vtext=`vagrant status 2>/dev/null | awk '{$1=""; print $0}' | sed 's/^ //g' | grep 'virtualbox' | GREP_COLOR="2;32" egrep --color=always "(not created|poweroff)"`
if [ -z "$vtext" ] ; then
View wp-query-ref.php
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@metaodi
metaodi / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.