Skip to content

Instantly share code, notes, and snippets.

@acidlemon
acidlemon / parallel.go
Last active August 29, 2015 14:10
embedded Perl in Go /w goroutine
package main
/*
#include <EXTERN.h>
#include <perl.h>
#include <stdio.h>
void init_perl() {
// PerlのCランタイムの初期化(全体で1回)
int argc = 0;
@acidlemon
acidlemon / 01_ListenAndServe.go
Created December 16, 2014 09:05
net/http workshop
package main
import (
"fmt"
"io"
"log"
"net/http"
)
func Handler(w http.ResponseWriter, req *http.Request) {
@vdw
vdw / gist:09efee4f264bb2630345
Last active January 31, 2023 08:55
Kill tcp connection with tcpkill on CentOS

Install tcpkill
yum -y install dsniff --enablerepo=epel

View connections
netstat -tnpa | grep ESTABLISHED.*sshd.

Block with ip tables
iptables -A INPUT -s IP-ADDRESS -j DROP

Kill connection

@hnakamur
hnakamur / kingpin_repeat_arg_example.go
Created January 7, 2016 03:14
An example of parsing a repeated argument like '-vvv' with kingpin
package main
import (
"fmt"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
verbose = kingpin.Flag("verbose", "Enable verbose mode.").Short('v').Counter()
@tkuchiki
tkuchiki / result.md
Last active August 15, 2019 03:28
[Openresty] %z だと nginx の iso_8601 の format と異なるので(: がない)、format を揃える
@tkuchiki
tkuchiki / rds.md
Last active September 26, 2016 02:34
aws cli まとめ (rds|aurora)

RDSの最新の自動取得 snapshot を取得する

$ aws rds describe-db-snapshots --snapshot-type automated | jq '.DBSnapshots | sort_by(.SnapshotCreateTime) | reverse | .[0]'
{
  "Engine": "mysql",
  "SnapshotCreateTime": "2016-09-25T18:46:55.366Z",
  "AvailabilityZone": "ap-northeast-1a",
  "PercentProgress": 100,
  "MasterUsername": "root",