teesocket.pl
Like tee
, but with dynamically-attached socket clients
Usage
Server mode
./teesocket.pl -s /tmp/my.sock
Like tee
, but with dynamically-attached socket clients
./teesocket.pl -s /tmp/my.sock
#include <arpa/inet.h> | |
#include <limits.h> | |
#include <math.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/time.h> | |
#include <unistd.h> | |
extern int h_errno; |
perl -MTime::HiRes=gettimeofday,tv_interval -e'my $tv=[gettimeofday];gethostbyname($ARGV[0]);print tv_interval($tv)."\n"' -- example.com |
yum install -y curl make gcc-c++ boost-devel openssl-devel | |
curl http://www.stunprotocol.org/stunserver-1.2.16.tgz | tar -xz | |
cd stunserver | |
make | |
cp stunserver /usr/sbin | |
cat - >/etc/init.d/stunserver <<'END' | |
#!/bin/sh | |
# chkconfig: 345 91 09 | |
### BEGIN INIT INFO | |
# Provides: stunserver |
import java.io.IOException; | |
import java.util.Map.Entry; | |
import java.util.Properties; | |
public class BuildInfoExample { | |
public static void main(String[] args) throws IOException { | |
Properties buildInfo = new Properties(); | |
buildInfo.load(BuildInfoExample.class.getClassLoader().getResourceAsStream("META-INF/build-info.properties")); | |
for(Entry<Object, Object> entry : buildInfo.entrySet()) { | |
System.out.println(entry.getKey() + ": " + entry.getValue()); |
#!/bin/bash | |
# | |
# Set up OSX preferences | |
# | |
# Inspired by: https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
########################################### | |
# CONFIG | |
if [ "$#" -lt 2 ]; then | |
echo -e "Usage: $0 {hostname} {timezone}\nExample: $0 machiavellia America/New_York" |
public class ExampleUsage extends HttpServlet { | |
private static final long serialVersionUID = 1L; | |
private static final ParameterValidator validator = new ParameterValidator() | |
.regex("userName", "^[a-z0-9.]{1,20}$") | |
.regex("fullName", "^[A-Za-z0-9.]{1,40}$", false) | |
.regex("street", "^[A-Za-z0-9 ]{1,30}$") | |
.regex("city", "^[A-Za-z ]{1,30}$") | |
.regex("zip", "^[A-Za-z0-9 ]{1,20}$") |
### | |
package autodeps; | |
### | |
use strict; | |
use warnings; | |
use Cwd qw/cwd abs_path/; | |
use File::Basename qw/dirname/; | |
use File::Spec::Functions qw/catdir/; |
override_git_prompt_colors() { | |
gp_pwd() { | |
local git_top="$(git rev-parse --show-toplevel 2> /dev/null)" | |
case "$1" in | |
out) local out="${git_top:+$(dirname $git_top)/}"; out="${out:-$PWD}"; printf '%s' "${out/#$HOME/~}" ;; | |
in) printf '%s' "${git_top:+${PWD#$git_top}}" ;; | |
*) printf '%s' "${git_top:+$(basename $git_top)}" ;; | |
esac | |
} | |
# Based mostly on Single_line_Ubuntu, but with some excess space removed |
task depsize { | |
group 'Help' | |
description 'Displays the sizes of all dependencies.' | |
doLast { | |
def size = 0, formatStr = "%,10.2f", out = new StringBuffer() | |
configurations.default.collect{it.length() / (1024 * 1024)}.each{size += it} | |
out << 'Total dependencies size:'.padRight(45) | |
out << "${String.format(formatStr, size)} Mb\n\n" | |
configurations.default.sort{-it.length()}.each { | |
out << "${it.name}".padRight(45) |