Skip to content

Instantly share code, notes, and snippets.

@goncha
goncha / lw-bootstrap.lisp
Created March 8, 2012 09:27
LispWorks bootstrap
(in-package "CL-USER")
(change-directory "D:\\code\\lisp\\")
(dolist (file (list "asdf.lisp"))
(compile-file file :load t))
(setf asdf:*central-registry*
(remove-if #'null
(mapcar #'(lambda (file) (if (eq :unspecific (pathname-name file)) file))
(directory #P"D:/code/lisp/"))))
@goncha
goncha / extract_audio_from_dvd
Created July 4, 2012 16:21
mencoder extract audio from DVD
mencoder dvd://8 -dvd-device G: -of rawaudio -oac mp3lame -lameopts cbr:br=192 -af resample=44100 -ovc copy -o test.mp3
@goncha
goncha / gist:3532090
Created August 30, 2012 16:15
Sum numbers in a file
grep -o "[0-9]\+M$" dl.txt | grep -o "[0-9]\+" | awk '{s+=$1} END {print s}'
grep -o "[0-9]\+M$" dl.txt | grep -o "[0-9]\+" | paste -sd+ | bc
@goncha
goncha / tomcat.zookeeper.StandardServerListener.java
Created September 14, 2012 06:45
Register Tomcat server instance in ZooKeeper directory
package tomcat.zookeeper;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@goncha
goncha / gist:3741416
Last active September 7, 2017 09:40
iptables nat & port forwarding
## set net.ipv4.ip_forward = 1 in /etc/sysctl.conf
## NAT:
iptables -t nat -A POSTROUTING -s 1.1.9.251/32 -o ${INET_DEV} -j SNAT --to-source ${INET_IP}
## PORT FORWARDING:
iptables -t nat -A PREROUTING -i ${INET_DEV} -p tcp -m tcp --dport ${INET_PORT} -j DNAT --to-destination ${LOCAL_IP}:${LOCAL_PORT}
@goncha
goncha / gist:3793040
Created September 27, 2012 09:12
cfengine to sync files from phub
bundle agent sync_app
{
vars:
"opt_dir" string => "/home/app/opt",
comment => "Program directory";
"etc_dir" string => "/home/app/etc",
comment => "Configuration directory";
files:
@goncha
goncha / gist:3909494
Last active October 11, 2015 19:38
forward gzipped error mail to remote address
############
# ~/.forward
############
"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #${USER}"
###############
# ~/.procmailrc
###############
@goncha
goncha / gist:3909695
Created October 18, 2012 03:23
simple tool test storage speed
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
@goncha
goncha / jetty6.xml
Last active February 16, 2017 22:52
jetty.xml to add a single context
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
<New class="org.mortbay.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
<Set name="lowThreads">20</Set>
@goncha
goncha / gist:4016202
Created November 5, 2012 09:11
build.gradel for simple Java webapp
apply plugin: "war"
apply plugin: "eclipse"
apply plugin: "jetty"
repositories {
// mavenCentral()
maven {
url "http://1.1.9.4:9000/archiva/repository/internal/"