Skip to content

Instantly share code, notes, and snippets.

@olekukonko
olekukonko / SSHCommander.go
Created February 9, 2015 02:51
The Nate Shells Out
package main
import (
"fmt"
"os"
"os/exec"
)
type SSHCommander struct {
User string

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

<?php
/**
* PHP XML to dynamic table
*
* @link http://stackoverflow.com/q/16997835/367456
*/
require('.../Iterator-Garden/src/autoload.php'); // for DecoratingIterator - use development branch
@olekukonko
olekukonko / parseInt64.go
Created April 26, 2014 11:32
strconv.ParseInt Faster Implementation to convert strings to int64
// Ascii numbers 0-9
const (
ascii_0 = 48
ascii_9 = 57
)
// parseInt64 expects decimal positive numbers. We
// return -1 to signal error
func parseInt64(d []byte) (n int64) {
if len(d) == 0 {
#! /usr/bin/env php
<?php
/* PHP Slowloris
* Adapted from the script found here: http://seclists.org/fulldisclosure/2009/Jun/207
* Contains get based attack (slow headers) and post based attack (long content length)
*
* Author: Seppe vanden Broucke
*/
function usage($argv){
@olekukonko
olekukonko / build.md
Last active August 29, 2015 13:57
Go Tips

Hide console Window when go applcation is lunched

go build -ldflags="-H windowsgui" -o prog.exe prog.go

# Download Sublime Text 2 from http://www.sublimetext.com/2
# If you aren't root, sudo su
tar -xvjf Sublime\ Text\ 2*.tar.bz2
mv Sublime\ Text\ 2/ /opt/sublime-text-2/
ln -s /opt/sublime-text-2 /usr/local/sublime-text-2
ln -s /usr/local/sublime-text-2/sublime_text /usr/local/bin/sublime_text
rm Sublime\ Text\ 2*.tar.bz2
# Sublime Text 2 can now be run as normal user with command "sublime_text"
type Account struct {
balance float64
deltaChan chan float64
balanceChan chan float64
errChan chan error
}
func NewAccount() (a *Account) {
a = &Account{
balance: balance,
deltaChan: make(chan float64),
import (
"net/url"
"github.com/dougblack/sleepy"
)
type Item struct { }
func (item Item) Get(values url.Values) (int, interface{}) {
items := []string{"item1", "item2"}
data := map[string][]string{"items": items}
@olekukonko
olekukonko / progress.go
Created February 5, 2014 13:59
Simple Progress
import(
"fmt"
"io"
"os"
"time"
)
const DEFAULT_FORMAT = "\r%s % 3d %% %d kb %0.2f kb/s %v "