Skip to content

Instantly share code, notes, and snippets.

View yukidarake's full-sized avatar
🎯
Focusing

Toshiyuki Nakamura yukidarake

🎯
Focusing
View GitHub Profile
@mala
mala / memcachedos.pl
Created August 13, 2010 11:49
DoS for memcached
#!/usr/local/bin/perl
# DoS tool for memcached
# ulimit -n 15000; perl memcachedos.pl 127.0.0.1 11211 3
# original: http://gist.github.com/522741
# This is Public Domain Software
use strict;
use warnings;
use AnyEvent;
snippet doc
/**
* ${1}
*/
snippet dochead
/**
* @fileoverview ${1}
* @author ${2}
* @version ${3}
@semind
semind / nginx.conf
Created December 30, 2011 02:41
nginx cookbook
##### nginxでリバースプロキシして後段でエラーが発生した場合にnginx側でエラーページの制御をしたい時の設定 #####
proxy_intercept_errors on; # errorをproxy側で肩代わりする設定
error_page 403 404 500 502 503 504 /error.html; # /var/www/html/error.htmlを置いておく
location /error.html {
root /var/www/html/;
}
#### headerの値を参照する ####
$http_フィールド名
@yukidarake
yukidarake / performance.js
Last active September 30, 2015 21:47
node.jsで最適なパフォーマンスを得るための書き方を測定
var Benchmark = require('benchmark');
var options = {
onStart : function() {
console.log('h1. ' + this.name + 'で一番速いのは?');
},
onCycle : function(event, bench) {
console.log('* ' + bench.name + '\t' + bench.hz.toFixed(bench.hz < 100 ? 2 : 0));
},
onComplete : function() {
@andypiper
andypiper / nuget.sh
Created May 8, 2012 16:18
nuget for OS X
#!/bin/sh
# add a simple 'nuget' command to Mac OS X under Mono
# get NuGet.exe binary from http://nuget.codeplex.com/releases/view/58939
# get Microsoft.Build.dll from a Windows .NET 4.0 installation
# copy to /usr/local/bin and Robert is your father's brother....
#
PATH=/usr/local/bin:$PATH
mono --runtime=v4.0 /usr/local/bin/NuGet.exe $*
fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@s9tpepper
s9tpepper / zombie_flash_detection_testing.js
Created September 27, 2012 18:54
Make Zombie think Flash is available
// These 'settings' put on the navigator will result in a plugin detection, not ActiveX
// I will link a gist for IE when I finish that one.
// edit: Link to IE example: https://gist.github.com/3796408
var SHOCKWAVE_FLASH = "Shockwave Flash",
FLASH_MIME_TYPE = "application/x-shockwave-flash";
this.Given(/^some step that tests Flash availability$/, function(callback) {
// Tell Zombie to pose as Safari 5.0
browser = new zombie.Browser({
@davemo
davemo / api.proxy.server.js
Created November 6, 2012 21:56
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});
@SeanHayes
SeanHayes / fabfile.py
Last active September 27, 2020 20:10
Example Fabric fabfile.py. It's a hodgepodge of old scripts and probably isn't best practice (uWSGI ought to have an init script), but it should give you a practical idea of how to use Fabric. This fabfile relies heavily on custom settings from a Django project in order to be more DRY. Includes commands for setting up a fresh Ubuntu Server insta…
# -*- coding: utf-8 -*-
#Copyright (C) 2013 Seán Hayes
import my_project.settings as dj_settings
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute
from fabric.contrib.files import exists
from fabric.decorators import hosts, roles, runs_once
import json
import logging
import os
@paulirish
paulirish / gist:5558557
Last active April 18, 2024 14:32
a brief history of detecting local storage

A timeline of the last four years of detecting good old window.localStorage.


Jan Lenhart, bless his heart contributed the first patch for support:

October 2009: 5059daa