Skip to content

Instantly share code, notes, and snippets.

@dynax60
dynax60 / linux.rc
Created March 30, 2011 05:24
Example of Hypnotoad startup-script for linux
#!/bin/bash
#
# Init file for Ping server daemon
#
# chkconfig: 2345 55 25
# description: Ping server daemon
#
# processname: ping
# pidfile: /var/run/ping.pid
@mfontani
mfontani / perl_miner.pl
Created June 27, 2011 08:16
A (test,simplistic) Perl bitcoin miner
#!/usr/bin/env perl
use 5.010_001;
use strict;
use warnings;
use Digest::SHA;
use JSON::XS;
use WWW::Mechanize;
use Time::HiRes qw<time gettimeofday tv_interval>;
use Getopt::Long;
@tmm1
tmm1 / elitedesktop.md
Created April 9, 2012 08:00
How to pimp your linux

THIS ASSUMES YOU RUN DEBIAN (or ubuntu, mint) AND ARE NOT A SUCKA MC

XDM

sudo aptitude install xdm
sudo echo '/usr/bin/xdm' > /etc/X11/default-display-manager

spectrwm, dmenu

sudo aptitude install dmenu libxtst-dev
git clone git://opensource.conformal.com/spectrwm.git
cd spectrwm/linux

@frsyuki
frsyuki / my_thoughts_on_msgpack.md
Created June 11, 2012 02:36
My thoughts on MessagePack

My thoughts on MessagePack

Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.

Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.

My high-level response to the comments

To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.

@avalanche123
avalanche123 / timeout.php
Created July 10, 2012 19:12
timeouts in php
<?php
class TimeoutException extends RuntimeException {}
class Timeout
{
private $active;
public function set($seconds)
{
@ser1zw
ser1zw / PLSQL_WWW_GET_SAMPLE.sql
Created September 20, 2012 19:03
PL/SQL sample for HTTP access
/*
PL/SQL sample for HTTP access (Oracle 11g R2)
1. Execute /u01/app/oracle/product/11.2.0/xe/rdbms/admin/utlhttp.sql to use UTL_HTTP package
Run the following command in shell in the DB server
$ cd /u01/app/oracle/product/11.2.0/xe/rdbms/admin/
$ sqlplus SYS/passwd@localhost:1521/XE AS SYSDBA @utlhttp.sql
2. Grant the connect and resolve privileges for all hosts to the user 'SCOTT'
Run the following commands in SQL*Plus
@phoenixg
phoenixg / header_http_status_codes.php
Created April 6, 2013 14:02
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
@kraih
kraih / c10k.pl
Last active March 20, 2021 14:33
#
# Open 10k concurrent WebSocket connections with the client and server running
# in the same process and perform 10k WebSocket message roundtrips
#
# Tested on OS X 10.9.2 (MacBook Air) with Perl 5.18.2 and EV 4.17 (kqueue)
#
# 560.9MB memory usage, 0% CPU usage once roundtrips are finished after 36s
# (with all 20k sockets still open)
#
# Get the latest version of Mojolicious from http://github.com/kraih/mojo
@kraih
kraih / Coro.pm
Last active April 19, 2019 13:48
package Mojolicious::Plugin::Coro;
use Mojo::Base 'Mojolicious::Plugin';
use Coro;
use Mojo::IOLoop;
# Wrap application in coroutine and reschedule main coroutine in event loop
sub register {
my ($self, $app) = @_;
my $subscribers = $app->plugins->subscribers('around_dispatch');
@lsauer
lsauer / kill_process_pid_windows_linux_mac.php
Last active January 21, 2020 21:30
PHP: kill a process by its process-id/pid in a platform- and library-independent manner
<?#!/usr/bin/php5
# www.lsauer.com, 2012 lo sauer
# desc: kill a process on Linux, MacOS, Windows without a process-control library
# in the php setup or environment
$kill = function($pid){ return stripos(php_uname('s'), 'win')>-1
? exec("taskkill /F /PID $pid") : exec("kill -9 $pid");
};
//e.g.
echo $kill(19008);
//> "Successfully terminated...."