Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h> /* for strncpy */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
@wolfg1969
wolfg1969 / launch-sql-power-architect.sh
Created January 16, 2013 07:17
use traditional method (java -cp) to launch the sql power architect, in this way the hive jdbc driver can work.
#!/bin/sh
cd ~/program/architect-1.0.6/
#java -jar architect.jar 2>&1 > /dev/null &
CLASS_PATH="$(echo lib/*.jar jdbc/*.jar | tr ' ' ':')"
java -cp ${CLASS_PATH}:architect.jar ca.sqlpower.architect.swingui.ArchitectFrame
@wolfg1969
wolfg1969 / pom.xml
Last active December 11, 2015 04:18
get hive-jdbc dependencies (with cloudera cdh4 repository) $ mvn clean dependency:copy-dependencies
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hive-deps</groupId>
<artifactId>hive-deps</artifactId>
<version>1.0-SNAPSHOT</version>
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@wolfg1969
wolfg1969 / applicationContext.xml
Created December 21, 2012 09:41
using commons-configuration with spring 3
<bean id="appConfig" class="org.apache.commons.configuration.PropertiesConfiguration">
<constructor-arg type="java.lang.String">
<value>app-config.properties</value>
</constructor-arg>
<property name="autoSave" value="true" />
</bean>
@wolfg1969
wolfg1969 / ipsec.conf
Created December 13, 2012 14:46 — forked from anonymous/ipsec.conf
l2tp vpn by storngwan and xl2tpd
config setup
nat_traversal=yes
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
charonstart=yes
plutostart=yes
conn L2TP
authby=psk
pfs=no
rekey=no
type=tunnel
@wolfg1969
wolfg1969 / gist:4273349
Created December 13, 2012 01:45
phabricator custom configuration
<?php
return array(
//'phabricator.setup' => true,
'phabricator.base-uri' => 'http://pb-server.yourdomain/',
'mysql.host' => 'localhost',
'mysql.user' => 'root',
'mysql.pass' => 'passwd',
'metamta.default-address' => 'noreply@pb-server.yourdomain',
'metamta.domain' => 'yourdomain',
@wolfg1969
wolfg1969 / gist:4273332
Created December 13, 2012 01:41
notify jenkins in a git post-receive script
GIT_REPO_URL=git@my_repository_server:`pwd | sed 's:.*\/::'`
curl http://my_ci_server:8080/git/notifyCommit?url=$GIT_REPO_URL
@wolfg1969
wolfg1969 / instagram-zh_CN.po
Created November 9, 2012 09:32
instapress zh_CN translation
# Copyright (C) 2010
# This file is distributed under the same license as the package.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/instapress\n"
"POT-Creation-Date: 2011-12-07 09:44:02+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
--[[
Clock Rings by Linux Mint (2011) reEdited by despot77
This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To