Skip to content

Instantly share code, notes, and snippets.

View akamajoris's full-sized avatar
💭
Life

Canis Majoris akamajoris

💭
Life
View GitHub Profile
@ezimuel
ezimuel / gist:9135151
Created February 21, 2014 14:24
Tesing SimpleXML and DOMDocument to prevent XXE attacks on XML
<?php
// The libxml entity loader is disabled by default
// even setting the libxml_disable_entity_loader to false doesn't works!
//
// @see http://uk3.php.net/manual/en/function.libxml-disable-entity-loader.php
// @see http://stackoverflow.com/a/10213239
$dir = __DIR__;
$content = 'This is a remote content!';
file_put_contents('content.txt', $content);
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active January 6, 2025 09:05
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@fridolin-koch
fridolin-koch / app.php
Created October 22, 2013 13:35
PHP AWS SDK - S3 StreamWrapper with ACL and ContentType
<?php
//autoloader
require_once __DIR__ . '/vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Enum\CannedAcl;
//init client
$s3Client = S3Client::factory(array(
'key' => '<key>',
'secret' => '<secret>',
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@saetia
saetia / parse.rb
Last active June 26, 2017 16:59
Parse MySQL dumps
ruby -e "$(curl -fsSkL https://gist.githubusercontent.com/saetia/2369908/raw/4bf9a6d36060582e69f02c314f66449971a7bb11/parse.rb)" /Users/Joel/site.db.121010.dump
ruby parse.rb site.120411.dump
@junaidpv
junaidpv / threadpool.py
Created August 7, 2011 14:20
A simple thread pool library for python programs.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A simple thread pool.
@author: Junaid P V
@license: GPLv3
"""