Skip to content

Instantly share code, notes, and snippets.

View tolland's full-sized avatar

Tom Hodder tolland

View GitHub Profile
@marcphilipp
marcphilipp / Eintrag.java
Created September 18, 2011 12:07
SWT Tree Drag and Drop
package de.marcphilipp.dnd.model;
public class Eintrag {
private final String description;
private Gruppe gruppe;
public Eintrag(String description) {
this.description = description;
}
@colonD
colonD / logstash_daily.sh
Created January 4, 2012 18:00
Quick cron.daily script for stock Logstash/ES installation
#!/bin/sh
# Do elasticsearch optimize on logstash previous day index
# if $1 = all then optimize all indicies
esindex="/opt/elasticsearch/data/elasticsearch/nodes/0/indices"
# Grab yesterday's values
D=`date +%d -d yesterday`
M=`date +%m -d yesterday`
Y=`date +%Y -d yesterday`
@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end
@nazgob
nazgob / gist:2367583
Created April 12, 2012 14:13
vagrant cheatsheet
# setup vagrant
gem install vagrant
vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
mkdir my_vagrant_test
cd my_vagrant_test
vagrant init lucid32
vim Vagrantfile
vagrant up
vagrant ssh
@tolland
tolland / Makefile
Created June 4, 2012 06:34 — forked from atdt/Makefile
Build and upload Chrome extensions to GitHub using APIv3
EXTNAME := extension
KEYFILE := $(EXTNAME).pem
CRXFILE := $(EXTNAME).crx
EXTDIR := $(EXTNAME)
SHELL := /usr/bin/env bash
CHROME := open /Applications/Google\ Chrome.app -n --args
CWD := $(shell pwd)
SIZE := $(shell wc -c <$(CRXFILE) | tr -d ' ')
VERSION := $(shell python -c "import json,sys;print json.loads(sys.stdin.read()).get('version','')" < $(EXTDIR)/manifest.json)
ZIPFILE := $(EXTNAME)-$(VERSION).crx
anonymous
anonymous / gist:2980348
Created June 23, 2012 22:36
lsusb -v for 5MP/220x adafruit microscope: https://www.adafruit.com/products/636
Bus 001 Device 006: ID 0ac8:3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0ac8 Z-Star Microelectronics Corp.
@digulla
digulla / FastXtextResourceSetProvider.java
Created September 20, 2012 07:11
Faster implementation of XtextResourceSetProvider.
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.ui.util.JdtClasspathUriResolver;
@mannieschumpert
mannieschumpert / gist:8886289
Last active August 2, 2020 13:15
Code Examples from Andrew Nacin's "Current User Can Watch This Talk"
<?php
// If you can edit pages, you can edit widgets
add_filter( 'user_has_cap',
function( $caps ) {
if ( ! empty( $caps['edit_pages'] ) )
$caps['edit_theme_options'] = true;
return $caps;
} );
@BenConstable
BenConstable / elasticsearch.conf
Last active November 15, 2018 11:41
Elasticsearch Upstart config
#
# Elasticsearch Service
#
# Tested with ES v1.5.2
#
# Doesn't currently support a configurable JVM.
#
# Adapted from the SysVInit script ES provides, which
# can be found here:
#

Basic

import code; code.interact(local=locals())

Advanced

IPython with embed()