This file contains 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 python | |
import argparse | |
import math | |
import sys | |
alphabets = { | |
"he": { | |
"א": 1, | |
"ב": 2, |
This file contains 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
for { | |
select { | |
case elem := <-a.traffChan: | |
a.aggregateTraff(elem.header, elem.body) | |
//!TODO maybe return elem to the pool | |
case elem := <-a.hitChan: | |
a.aggregateHit(elem.header, elem.body) | |
//!TODO maybe return elem to the pool | |
case <-a.stopChan: | |
close(a.traffChan) |
This file contains 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 | |
$string = 'lalalalala'; | |
$string = preg_replace('/(a+)/', 'many-a', $string); | |
// continue my work with string | |
// hopefully it is "lmany-almany-almany-almany-almany-a" | |
?> |
This file contains 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
[~/playfield] | |
iron4o$ which js | |
/usr/bin/js | |
[~/playfield] | |
iron4o$ ls -lh /usr/bin/js | |
lrwxrwxrwx 1 root root 20 Feb 6 2012 /usr/bin/js -> /etc/alternatives/js | |
[~/playfield] | |
iron4o$ ls -lh /etc/alternatives/js | |
lrwxrwxrwx 1 root root 13 Feb 6 2012 /etc/alternatives/js -> /usr/bin/node | |
[~/playfield] |
This file contains 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
#!/bin/bash | |
cd $(dirname `readlink -f $0`) | |
git_dirs=`find . -maxdepth 1 -type d | grep -v -E '^\.$'` | |
for git_dir in $git_dirs | |
do | |
echo "Entering $git_dir" | |
cd "$git_dir" |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<header></header> | |
<body> | |
<progress value="5" max="13" id="prog"></progress> | |
<script> | |
_t = null; | |
function progress () { | |
if (_t) { | |
clearTimeout(_t); |
This file contains 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
#!/bin/bash | |
while [[ true ]]; do | |
echo "[`date`] Repeating $1" | |
START=`date +%s` | |
$1 | |
END=`date +%s` | |
DURATION=`echo "$END-$START" | bc` |
This file contains 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
#!/bin/sh | |
if [ $# -lt 1 ] | |
then | |
echo "Usage: $0 remote.host.name [port]" | |
exit 1 | |
fi | |
REMHOST=$1 | |
REMPORT=${2:-443} |
This file contains 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 | |
// freakishly distrustful about its arguments function | |
function document_mark_as_sent($invoices){ | |
global $page, $db; | |
if(empty($invoices)){ return; } | |
if(!is_array($invoices)){ $invoices = array((int)$invoices); } | |
if(!is_object($page) or !is_object($db)){ return; } | |
if(!isset($page->firm) or !$page->firm){ return; } | |
if( is_object($invoices[0]) ){ // значи е масив от Invoice обекти | |
$invoices = array_map(create_function('$i', 'return $i->id;'), $invoices); |
This file contains 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
#include <iostream> | |
#include <sys/time.h> | |
int main (int argc, char * const argv[]) { | |
timeval start, end; | |
long mtime, seconds, useconds; | |
gettimeofday(&start, NULL); | |
int * arr = new int[100000000]; |
NewerOlder