Skip to content

Instantly share code, notes, and snippets.

View ericychoi's full-sized avatar

Eric Choi ericychoi

  • SendGrid
  • Anaheim, CA
View GitHub Profile
@ericychoi
ericychoi / tcp-proxy.sh
Last active November 26, 2021 13:15
A quick tcp proxy bash script using nc (not my original)
#!/bin/sh -e
# usage: ./tcp-proxy.sh 8080 tweakers.net 80
# script written by
# https://notes.tweakblogs.net/blog/7955/using-netcat-to-build-a-simple-tcp-proxy-in-linux.html
if [ $# != 3 ]
then
echo "usage: $0 <src-port> <dst-host> <dst-port>"
exit 0
@ericychoi
ericychoi / benchmark_keys.pl
Created February 23, 2017 19:01
Perl Benchmark Keys on Hash
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark;
print "Perl version $]\n";
my %subs;
@ericychoi
ericychoi / benchmark_keys.pl
Created February 23, 2017 19:33
Perl Benchmark on Keys (with a wrapper function)
#!/opt/perl/bin/perl
use strict;
use warnings;
use Benchmark;
# Perl version 5.010001
# Rate 10^4 keys 10^3 keys 10^5 keys 10^1 keys 10^2 keys
# 10^4 keys 2429401/s -- -0% -1% -2% -2%
@ericychoi
ericychoi / private.xml
Created April 5, 2017 15:53
Karabiner-private.xml for mapping mouse forward/back buttons to next/prev space
<?xml version="1.0"?>
<root>
<item>
<identifier>private.button_4_next_space</identifier>
<name>Mouse buttons to move spaces</name>
<appendix>Mouse button 4 to next space</appendix>
<autogen>
__KeyToKey__
PointingButton::BUTTON4,
KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L | ModifierFlag::CONTROL_L
@ericychoi
ericychoi / Async.pm
Last active May 30, 2017 19:59
An attempt to implement Async waterfall in AnyEvent perl
package Async;
use warnings;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT_OK = qw(waterfall);
# waterfall: executes mutliple subroutines in series, passing result from previous run to the next.