This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -MTime::HiRes=gettimeofday,tv_interval -e'my $tv=[gettimeofday];gethostbyname($ARGV[0]);print tv_interval($tv)."\n"' -- example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socket$_,2,1,6;setsockopt$_,1,2,pack"l",1;(bind$_,pack"snN3",2,pop)||die$!;listen$_,128;{accept+my($c),$_;fork&&redo;($_)=<$c>=~/(\/\S*)/;s/%([0-9a-f]{2})/pack"H2",$1/eig;s-/$-/index.html-;!/\.\./&&open$a,"<.$_"||last;syswrite$c,"HTTP/1.1 200\x0D\x0A\x0D\x0A";syswrite$c,$,until!sysread$a,$,,1024} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use threads; | |
use File::Temp; | |
use POSIX qw/mkfifo/; | |
my $pid = shift @ARGV; | |
my $eval = shift @ARGV || 'require Carp; local $Carp::CarpLevel = 1; Carp::cluck(\'Currently\');'; | |
my $thread = $ENV{'GDB_THREAD'} || 'all'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HTTP POST with chunked encoding. | |
* | |
* Usage: | |
* cc chunkedpost.c -lcurl -o chunkedpost | |
* ./chunkedpost | |
* | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key><string>local.gdrive-dropbox-sync</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/sh</string><string>-c</string> | |
<string>/usr/local/bin/unison \ | |
-times \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}$") |