This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rules for DNS | |
iptables -A OUTPUT -p udp --dport 53 --sport 1024:65535 -j ACCEPT | |
iptables -A INPUT -p udp --dport 53 --sport 1024:65535 -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(rq_handler). | |
-compile({parse_transform, leptus_pt}). | |
%% leptus callbacks | |
-export([init/3]). | |
-export([get/3]). | |
-export([use/3]). | |
-export([terminate/3]). | |
init(_Route, _Req, State) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
int i, j; | |
int *p; | |
p = &i; | |
*p = 5; | |
j = i; | |
printf("addresses: i = %d, j = %d, p = %d\n", &i, &j, p); | |
printf("values: i = %d, j = %d, p = %d\n", i, j, *p); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# chkconfig: 2345 20 80 | |
# description: Description comes here.... | |
start() { | |
# code to start app comes here | |
/path/to/forever start /path/to/app.js | |
} | |
stop() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
var http = require('http'); | |
var numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
// Fork workers | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On server (admin) | |
$ yum install git | |
$ useradd gitolite | |
$ passwd gitolite | |
$ su gitolite | |
$ cd | |
$ git clone git://github.com/sitaramc/gitolite.git | |
$ mkdir bin | |
$ gitolite/install -ln | |
$ gitolite setup -pk admin.pub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone git://github.com/alanxz/rabbitmq-c.git | |
$ cd rabbitmq-c | |
$ git submodule init | |
$ git submodule update | |
$ yum install libtool | |
$ yum install autoconf | |
$ yum install automake | |
$ yum install php-pear | |
$ yum install php-devel | |
$ make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set variables | |
$url = 'http://path/to/your/target'; | |
$className = 'foo'; | |
// Initialize CURL | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Classical OOP | |
function Person(name) { | |
this.name = name | |
} | |
Person.prototype = { | |
greet: function () { | |
return "Hello world, my name is " + this.name; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Table | |
CREATE TABLE IF NOT EXISTS `foo_table` ( | |
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, | |
`bar_column` varchar(10) NOT NULL, | |
`bat_column` varchar(10) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
# Load Data | |
load data local infile '/path/to/file.csv' into table `foo_table` |