Like tee
, but with dynamically-attached socket clients
./teesocket.pl -s /tmp/my.sock
# Using AWS instance IAM role to provide credentials to minio-client cli. | |
# Works in Alpine 3.18+ (the minio-client package is not available in 3.17) | |
# Should also work anywhere else minio, curl, and jq can run. | |
# Provides a very-lightweight way to access S3 from Alpine | |
apk add minio-client curl jq | |
export MC_HOST_s3=$(curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/$(curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ | head -1) | jq -r '"https://\(.AccessKeyId):\(.SecretAccessKey):\(.Token)@s3.amazonaws.com"') | |
mcli ls s3/mybucket |
#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 |