Skip to content

Instantly share code, notes, and snippets.

View Gargron's full-sized avatar

Eugen Rochko Gargron

View GitHub Profile
var Node = function (config, _isTerminal) {
this.config = config;
this._isTerminal = _isTerminal;
};
Node.prototype.isTerminal = function () {
this.evaluate();
return this._isTerminal;
};
@Gargron
Gargron / docker-run
Created January 14, 2015 12:14
Git hook (post-update) for gitolite
#!/bin/bash
echo "Going to handle Docker image now..."
HOME="/home/dkr"
REPO=$GL_REPO
BARE_PATH="$HOME/repositories/$REPO.git"
WORK_PATH="$HOME/$REPO"
USER=$GL_USER
@Gargron
Gargron / sorter.php
Created March 27, 2012 21:41
PHP Sorter abstraction
<?php namespace Sorter;
class Sorter
{
/**
* Apply sorting logic to a given DB query. Look-up the model's rules to allow/disallow and alias sorting types
*
* @param $sort_by string Sorting subject
* @param $direction integer 1 or -1
* @param $query string
@Gargron
Gargron / apiauth.php
Created April 23, 2012 16:14
API call authorization class for The Colorless API
<?php
/**
* Used to authorize API calls based on public API keys
* and private encryption comparison. Only useful for
* server-side API calls since you'd have to open
* up the private key in plaintext if you tried to do
* this from JavaScript.
*
* @author Eugen Rochko
@Gargron
Gargron / gist:3579337
Created September 1, 2012 16:24
Metrics with Mongo
<?php
/**
* Example usage:
*
* Metric::record(1, 'slot', 12, 'impression');
*
*/
class Metric
import java.util.ArrayList;
import java.util.Collections;
/**
* Knoten
*
* @author Eugen Rochko
*/
class Node {
@Gargron
Gargron / home-backup.sh
Created October 14, 2013 15:16
Script to do an incremental backup of the home directory of a user
#! /bin/sh
DRIVE_PATH="/path/to/drive"
USER="joe"
BACKUP_PATH="$DRIVE_PATH/backups/$USER@$(hostname)"
if command -v rdiff-backup >/dev/null 2>&1; then
echo "Checking drive..."
if ! [ -d "$DRIVE_PATH" ]; then
@Gargron
Gargron / README.md
Last active December 30, 2015 23:29
Configure a list of YouTube channels, and you can run this regularly to download new videos.

Configure a list of YouTube channels, and you can run this regularly to download new videos.

Creates .check-youtube folder in the user's home directory, where configuration and videos are stored. Example config.yml:

channels:
  - bluexephos
  - YogscastSips

Uses Ruby and the YouTube DL command-line utility.

Keybase proof

I hereby claim:

  • I am gargron on github.
  • I am gargron (https://keybase.io/gargron) on keybase.
  • I have a public key ASCgyQA2BYJllYUj8f0FLZylBC5NS1gGpBq-v56UUATiswo

To claim this, I am signing this object:

<https://macgirvin.com/channel/mike> <http://purl.org/zot/protocollocations> <https://macgirvin.com/channel/mike> .
<https://macgirvin.com/channel/mike> <http://salmon-protocol.org/ns/magic-envenv> _:c14n4 .
<https://macgirvin.com/channel/mike> <http://salmon-protocol.org/ns/magic-envmagic_keys> _:c14n3 .
<https://macgirvin.com/channel/mike> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/ns/activitystreams#Person> .
<https://macgirvin.com/channel/mike> <http://www.w3.org/ns/ldp#inbox> <https://macgirvin.com/inbox/mike> .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#endpoints> _:c14n0 .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#icon> _:c14n2 .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#name> "Mike Macgirvin" .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/activitystreams#outbox> <https://macgirvin.com/outbox/mike> .
<https://macgirvin.com/channel/mike> <https://www.w3.org/ns/ac