Skip to content

Instantly share code, notes, and snippets.

@hellectronic
hellectronic / dns-sync.sh
Created October 18, 2018 13:00 — forked from matthiassb/dns-sync.sh
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@hellectronic
hellectronic / Apriori.java
Created March 7, 2017 21:04 — forked from monperrus/Apriori.java
Java implementation of the Apriori algorithm for mining frequent itemsets
import java.io.*;
import java.util.*;
/** The class encapsulates an implementation of the Apriori algorithm
* to compute frequent itemsets.
*
* Datasets contains integers (>=0) separated by spaces, one transaction by line, e.g.
* 1 2 3
* 0 9
* 1 9
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@hellectronic
hellectronic / .rvmrc
Created July 28, 2011 17:11
RVM .rvmrc and redmine_inst.gems files for a Redmine installation
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# https://github.com/wayneeseguin/rvm-site/blob/master/.rvmrc
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.8.7@redmine_inst"
#
@hellectronic
hellectronic / eventbus-spring-config.xml
Created April 8, 2011 12:19
Eventbus configuration with Spring
<bean id="eventbusInit" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<util:properties>
<prop key="org.bushe.swing.event.swingEventServiceClass">org.bushe.swing.event.ThreadSafeEventService</prop>
</util:properties>
</property>
</bean>
@hellectronic
hellectronic / gist:745812
Created December 17, 2010 22:20
sbt tasks for mongodb
val host = "localhost"
val port = 27017
val dbname = "test"
val mongodbSciptPath = testResourcesPath / "mongodb"
val datagenFile = mongodbSciptPath / "datagen.js" absolutePath
val cleanDbFile = mongodbSciptPath / "cleandb.js" absolutePath
lazy val dropDb = withArgsTest("please provide a db name", _.length > 0) {
args => MongoCli().eval("db.dropDatabase()").host(host).port(port).db(args(0)).cmd
}
var cleandb = function() {
var cols = db.getCollectionNames();
for (var i = 0; i < cols.length; i++) {
db.getCollection(cols[i]).remove({});
}
};
cleandb();