Skip to content

Instantly share code, notes, and snippets.

View bakytn's full-sized avatar

Bakyt Niyazov bakytn

  • Bishkek, Kyrgyz Republic
View GitHub Profile
@bakytn
bakytn / pre-receive
Last active February 5, 2016 06:43 — forked from proofek/pre-receive
pre-receive git hook to run php linter
#!/usr/bin/php
<?php
error_reporting(0);
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
<?php
try {
// configure database access parameters
$host = "";
$dbname = "";
$user = "";
$pass = "";
$dbh = new PDO("pgsql:host=$host;dbname=$dbname", $user, $pass);
$table_list = get_all_table_list();
In this homework you will build a small replica set on your own computer. We will check that it works with validate.py, which you should download in week6-lessonfiles.tar or week6-lessonfiles.zip.
Create three directories for the three mongod processes. On unix, this could be done as follows:
mkdir -p /data/rs1 /data/rs2 /data/rs3
Now start three mongo instances as follows. Note that are three commands. The browser is probably wrapping them visually.
./mongod --replSet m101 --logpath "1.log" --dbpath /data/rs1 --port 27017 --smallfiles --fork
./mongod --replSet m101 --logpath "2.log" --dbpath /data/rs2 --port 27018 --smallfiles --fork
./mongod --replSet m101 --logpath "3.log" --dbpath /data/rs3 --port 27019 --smallfiles --fork
@bakytn
bakytn / gist:5523037
Last active December 17, 2015 00:39
Quick command line Google Translate
#!/usr/bin/php
<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.11\r\n",
"Referer: http://translate.google.com/\r\n"
UUID=ad180bc9-3578-4a42-8fc1-54cabd2bffff / ext4 noatime,nodiratime,data=writeback,barrier=0,nobh,discard,errors=remount-ro 0 1