Skip to content

Instantly share code, notes, and snippets.

View dlsniper's full-sized avatar

Florin Pățan dlsniper

View GitHub Profile
@dlsniper
dlsniper / diff
Created March 2, 2016 00:35
runtime changes test results
name old time/op new time/op delta
BinaryTree17-8 3.84s ± 2% 3.83s ± 4% ~ (p=0.365 n=19+20)
Fannkuch11-8 3.57s ± 2% 3.56s ± 3% ~ (p=0.095 n=19+20)
FmtFprintfEmpty-8 70.4ns ± 3% 69.2ns ± 6% -1.67% (p=0.036 n=19+20)
FmtFprintfString-8 230ns ± 2% 228ns ± 2% ~ (p=0.194 n=19+19)
FmtFprintfInt-8 221ns ± 1% 218ns ± 2% -1.47% (p=0.000 n=16+18)
FmtFprintfIntInt-8 359ns ± 2% 356ns ± 2% -0.76% (p=0.017 n=19+19)
FmtFprintfPrefixedInt-8 321ns ± 1% 311ns ± 1% -3.13% (p=0.000 n=20+20)
FmtFprintfFloat-8 432ns ± 1% 452ns ± 2% +4.65% (p=0.000 n=20+18)
FmtManyArgs-8 1.40µs ± 1% 1.35µs ± 2% -3.47% (p=0.000 n=18+19)
@dlsniper
dlsniper / install go.ps
Created January 28, 2016 09:54
Install go
$cwd = $PSScriptRoot+"\"
$gosdk = $cwd+"go"
$zip7 = $cwd+"7z"
$mingw = $cwd+"mingw64"
$gitdir = $cwd+"git"
$gopath = $cwd+"gopath"
# Install Go
if (-Not (Test-Path $gosdk)) {
echo "Installing Go into: "$gosdk
@dlsniper
dlsniper / cloc.txt
Last active July 2, 2016 18:45
cloc GOPATH
cloc $GOPATH/src
355977 text files.
146076 unique files.
265536 files ignored.
github.com/AlDanial/cloc v 1.70 T=1536.51 s (60.4 files/s, 22195.2 lines/s)
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
Go 35916 1312637 1831205 8843502
@dlsniper
dlsniper / sad2.php
Last active September 21, 2015 12:14
Inno solution for sadness
<?php
class human {
public function stop() {
print("https://youtu.be/DgvePeDIt3Y");
}
}
function sad() {
$return = isset($GLOBALS["sad_called"]) && $GLOBALS["sad_called"] === true ? new human() : true;
@dlsniper
dlsniper / genpwd.sh
Last active September 1, 2015 20:30
Generate password with bash
#!/usr/bin/env bash
# This generates a password
# The MIT License (MIT)
#
# Copyright (c) 2015 Florin Patan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@dlsniper
dlsniper / modifiedLog.java
Last active August 29, 2015 14:26
Modified Android Logging sample
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dlsniper
dlsniper / poor horse.json
Created July 19, 2015 21:29
just another attack
{
"remote_addr":"***",
"name":"home",
"status_code":200,
"method":"GET",
"request_uri":"/",
"headers":{
"Cache-Control":[
"no-cache"
],
@dlsniper
dlsniper / main.go
Created March 29, 2015 11:19
HTTPS server in go using COMODO Wildcard SSL certificate (exported as nginx bundle)
package main
import (
"crypto/rand"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"log"
mr "math/rand"
"net/http"
@dlsniper
dlsniper / example_parameters.go
Created February 11, 2015 21:36
Example on how to get URL parameters
package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
func demo(w http.ResponseWriter, r *http.Request) {
@dlsniper
dlsniper / tutorial.md
Last active February 28, 2020 07:56
How to build nginx from sources on Ubuntu
export LANGUAGE="en_US.UTF-8" 
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
locale-gen en_US.UTF-8 
dpkg-reconfigure locales

apt-get install unzip libpcre3 libpcre3-dev libssl-dev libpcrecpp0 zlib1g-dev debhelper dh-systemd libgeoip-dev autotools-dev libgd2-noxpm-dev libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev po-debconf libexpat-dev libxslt1-dev