Skip to content

Instantly share code, notes, and snippets.

View kost's full-sized avatar
💭
I'm upto something

kost kost

💭
I'm upto something
  • Diverto
  • Zagreb, Croatia
  • X @k0st
View GitHub Profile
@kost
kost / gist:1494305
Created December 18, 2011 20:05 — forked from avsej/gist:741722
build ruby for arm platform (e.g. for amazon kindle)
echo "deb http://emdebian.org/debian/ lenny main" >> /etc/apt/sources.list
apt-get update
apt-get install binutils-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi libc6-dev-armel-cross
cd /path/to/ruby/1.8.7/sources
autoconf
CFLAGS="--static" LDFLAGS="--static" CC="arm-linux-gnueabi-gcc" ac_cv_func_setpgrp_void=yes ac_cv_func_isinf=no ac_cv_func_isnan=no ac_cv_func_finite=no CROSS_COMPILING=1 ./configure --host="arm-linux-gnueabi" --prefix=/mnt/us/opt
make
make install
@kost
kost / datapipe6.c
Created January 22, 2012 06:13 — forked from feuvan/datapipe6.c
Datapipe6 - ipv6-aware fork of datapipe.c
/*
* Datapipe6 - ipv6-aware fork of datapipe.c
* Sample usage:
* datapipe6 localipv4addr 23 remoteipv6addr 23
*
*
* Written by feuvan <feuvan@feuvan.net>
* Original ipv4 version by Jeff Lawson <jlawson@bovine.net>
* See statement below
*
@kost
kost / uri.js
Created April 21, 2012 10:13 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.host; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
@kost
kost / harden.sh
Created November 16, 2015 04:47 — forked from jumanjiman/harden.sh
hardening script for an alpine docker container
#!/bin/sh
set -x
set -e
#
# Docker build calls this script to harden the image during build.
#
# NOTE: To build on CircleCI, you must take care to keep the `find`
# command out of the /proc filesystem to avoid errors like:
#
# find: /proc/tty/driver: Permission denied
@kost
kost / testingDAO v1.1
Created June 5, 2016 19:10 — forked from D-Nice/testingDAO v1.1
DAO for use in testing and finding any bugs in V1.1 features
/*
- Bytecode Verification performed was compared on second iteration -
This file is part of the DAO.
The DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@kost
kost / run_burp.sh
Created September 28, 2016 09:54 — forked from jamesbcook/run_burp.sh
#!/bin/bash
BURPFOLDER="$HOME/Documents/burp"
SAVESTATEROOT="$BURPFOLDER/burpState"
cd $BURPFOLDER
# LATESTBURP=$(ls -1 burpsuite* | tail -n 1)
LATESTBURP=$(ls -1t burp*.jar | head -n1)
echo "Running ${LATESTBURP}"
@kost
kost / gist:8445cd68f0af98d27ca69e5d53192d61
Created October 6, 2016 06:56 — forked from mjpowersjr/gist:740a9583e9ec8b49e0a3
Parsing the MySQL slow query log via Logstash (the easy way?)

The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!

From the MySQL documentation:

By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.

my.cnf

Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!

# enable slow query log
@kost
kost / golang-tls.md
Created October 23, 2016 02:01 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@kost
kost / endian.h
Created November 4, 2016 06:59 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.