Skip to content

Instantly share code, notes, and snippets.

View ergoz's full-sized avatar
😈
let's rock

[riftlab] ErgoZ ergoz

😈
let's rock
View GitHub Profile
<?php
// "!defined('determinator') == "include_once" for sneaky people.
if (!defined("determinator")){
function determinator_feof($file_pointer, &$now = NULL) {
// Assigning a value to $now in this function changes
// the value of whatever variable the calling function
// passed in. Functions with side effects... huzzah!
$now = microtime(true);
// Have we reached the end of the file?
# install dependencies
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm
# clone cpuminer
git clone https://github.com/pooler/cpuminer.git
# compile
cd cpuminer
./autogen.sh
./configure CFLAGS="-O3"
@ergoz
ergoz / gist:8252765
Created January 4, 2014 07:40
time diff
/*
Этот код был создан для онлайн сервиса planetcalc.ru пользователем Timur.
Код доступен на условиях лицензии Creative Commons Attribution/Share-Alike License 3.0 (Unported) (by-sa).
Вы можете использовать его (копировать и модифицировать) только с сохранением оригинального лицензионного соглашения,
а также при условии размещения ссылки на оригинальную работу http://planetcalc.ru/864/.
*/
function Calculate( time1, time2, diff, diff2 ) {
var totalmin1 = time1.getHours( ) * 60 + time1.getMinutes( );
var totalmin2 = time2.getHours( ) * 60 + time2.getMinutes( );
var diffmin = Math.abs( totalmin1 - totalmin2 );
#!/usr/bin/env ruby
#encoding: utf-8
# Внимание! Скрипт работает только на версии ruby 2.0
# create_rus_ruby_book filename -> возвращается результат обработки файла;
# create_rus_ruby_book dirname -> все *.md файлы будут обработаны. Результат сохраняется в *.tex файл с тем же именем (файл будет перезаписан).
require 'redcarpet'
\ProvidesPackage{rus_ruby_book}
\clubpenalty=10000 % запрет разрыва после первой строки абзаца.
\widowpenalty=10000 % запрет разрыва перед последней строкой абзаца.
\tolerance=5000
\RequirePackage{xltxtra}
\RequirePackage{xunicode}
\RequirePackage{xecyr}
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@ergoz
ergoz / eds.c
Created February 14, 2014 12:12
run phpunit as another unit (suid)
/*
* This tool used to run PHPUnit tests by apache user
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#define KNRM "\x1B[0m"
http {
map $http_user_agent $limit_bots {
default '';
~*(google|bing|yandex|msnbot) $binary_remote_addr;
}
limit_req_zone $limit_bots zone=bots:10m rate=1r/m;
server {

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array