Skip to content

Instantly share code, notes, and snippets.

function do_insert_html(doc, type, element, html) {
var new_element = doc.createElement(type);
new_element.innerHTML = html;
element.parentNode.insertBefore(new_element, element);
};
function engine(name, link,img) {
this.link = link;
this.img = img;
this.name = name;
function engine(name, link,img) {
this.link = link;
this.img = img;
this.name = name;
}
var form = document.forms.namedItem("gs");
var input = form.elements.namedItem("q");
var eq = encodeURI(input.value);
% /sbin/sysctl fs.file-max net.core.somaxconn net.core.rmem_max net.core.wmem_max net.ipv4.tcp_rmem net.ipv4.tcp_wmem net.ipv4.tcp_fin_timeout
fs.file-max = 303065
net.core.somaxconn = 128
net.core.rmem_max = 131071
net.core.wmem_max = 131071
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_fin_timeout = 60
diff -ur libevent-1.3b.original/event.c libevent-1.3b/event.c
--- libevent-1.3b.original/event.c 2007-02-16 09:49:06.000000000 +0900
+++ libevent-1.3b/event.c 2010-08-15 00:58:14.000000000 +0900
@@ -790,13 +790,13 @@
docount = 0;
if (docount)
- base->event_count--;
+ __sync_sub_and_fetch(&(base->event_count), 1);
diff -u libevent-1.4.14b-stable.orig/event.c libevent-1.4.14b-stable/event.c
--- libevent-1.4.14b-stable.orig/event.c 2010-06-20 22:06:04.000000000 +0900
+++ libevent-1.4.14b-stable/event.c 2010-08-15 02:34:35.000000000 +0900
@@ -50,6 +50,7 @@
#include <string.h>
#include <assert.h>
#include <time.h>
+#include <pthread.h>
#include "event.h"
@stanaka
stanaka / idm2keepassx.rb
Created August 5, 2012 10:17
Convert IDM export XML to KeepassX XML
#! /usr/bin/env ruby
# idm2keepassx.rb
# convert IDM export XML to KeepassX XML
#
# usage:
# cat idm_export.xml | idm2keepassx.rb > keepassx.xml
require "rexml/document"
require "date"
cat idm_export.xml | nkf -w | sed 's/encoding="shift-jis"/encoding="utf-8"/'| idm2keepassx.rb > keepassx.xml
@stanaka
stanaka / generate_pdf.pl
Created October 15, 2012 15:05
Generate pdf for analyzing kindle paperwhite resolution
#!/usr/bin/env perl
use strict;
use warnings;
use GD;
sub draw_page {
my ($width, $height) = @_;
return unless $width && $height;
@stanaka
stanaka / gist:4139081
Created November 24, 2012 09:58
weechat patch for enabling charset plugin
diff --git a/Library/Formula/weechat.rb b/Library/Formula/weechat.rb
index 52eee04..8fdbb0d 100644
--- a/Library/Formula/weechat.rb
+++ b/Library/Formula/weechat.rb
@@ -20,6 +20,10 @@ class Weechat < Formula
option 'python', 'Build the python module (requires framework Python)'
option 'aspell', 'Build the aspell module that checks your spelling'
+ def patches
+ DATA
@stanaka
stanaka / ltsv.rb
Created February 8, 2013 12:53
Simple parser for a LTSV (Labeled Tab-separated Values: http://ltsv.org) file
#!/usr/bin/env ruby
while gets
record = Hash[$_.split("\t").map{|p| p.split(":", 2)}]
p record
end