Skip to content

Instantly share code, notes, and snippets.

View xlab's full-sized avatar
:octocat:
Hacking

Max Kupriianov xlab

:octocat:
Hacking
View GitHub Profile
@lox
lox / Dockerfile
Created June 23, 2014 07:46
Getting a golang binary with x.509 to run under busybox
FROM progrium/busybox
ADD https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt /etc/ssl/ca-bundle.pem
@cryptix
cryptix / client.go
Created June 22, 2014 11:09
multipart upload with io.Pipe
package main
import (
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"runtime"
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

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

@denji
denji / nginx-tuning.md
Last active May 8, 2025 19:46
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@urre
urre / nginbox
Last active December 27, 2015 02:09
Nginbox: Custom Domain for Dropbox Public Directory
server{
listen 80;
server_name dropbox.urre.me
location / {
set $index index.html;
rewrite ^.*\/$ $fastcgi_script_name$index last;
proxy_pass https://dl.dropboxusercontent.com/u/XXXXXXX/;
proxy_redirect off;
@kavu
kavu / example.go
Created September 28, 2013 10:01
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rnapier
rnapier / fix-xcode
Last active October 31, 2024 13:54
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <[email protected]>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@xlab
xlab / matchbox-window-manager-matan.diff
Created July 26, 2012 13:56
Enable movable dialogs (DIALOGMODE=free) in 'matchbox-window-manager'
diff -ur orig/matchbox-window-manager-1.2/src/dialog_client.c matchbox-window-manager-1.2/src/dialog_client.c
--- orig/matchbox-window-manager-1.2/src/dialog_client.c 2007-08-16 08:51:54.000000000 +0300
+++ matchbox-window-manager-1.2/src/dialog_client.c 2008-10-13 13:12:02.000000000 +0200
@@ -667,8 +667,8 @@
int bdr_south = 0, bdr_west = 0, bdr_east = 0, bdr_north = 0;
/* Check if we actually want to perform any sizing intervention */
- if (w->config->dialog_stratergy == WM_DIALOGS_STRATERGY_FREE)
- return;
+// if (w->config->dialog_stratergy == WM_DIALOGS_STRATERGY_FREE)