Skip to content

Instantly share code, notes, and snippets.

View tomer's full-sized avatar

Tomer Cohen tomer

View GitHub Profile
@tomer
tomer / list_zones.py
Created March 3, 2012 23:13
Convert CLDR zones into Mediawiki markup
import xml.dom.minidom
import os.path
import urllib2
def getText(item):
return " ".join(t.nodeValue for t in item.childNodes if t.nodeType == t.TEXT_NODE)
def get_file(filename, url):
f = urllib2.urlopen(url)
@tomer
tomer / .htaccess
Created July 2, 2012 11:23
rewrite files to download script by extensions
RewriteEngine on
RewriteRule ^(.*\.(rar|zip|pdf|tar|gz|iso))$ /~tomer/redirect/download.php?file=$1
@tomer
tomer / create_profile.sh
Created August 21, 2012 20:44
b2g profile builder script
#!/bin/bash
#
# b2g Profile builder script
# The script will clone gaia, build a clean profile and pack it into tar.bz2 archive.
# - Tomer Cohen <http://tomercohen.com/?p=1275>
if [ ! -d gaia ];
then
git clone git://github.com/mozilla-b2g/gaia ;
else
rm -rf gaia/profile ;
@tomer
tomer / index.html
Created August 27, 2012 09:39
FreeFax.co.il refreshed fax submission form proposal
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Abstract layout for freefax.co.il new fax submittion form</title>
<script>
function showNextUploadField(myID) {
if (document.getElementById('u' + myID) != "")
addUploadField(myID + 1);
else
@tomer
tomer / _config.yml
Created March 22, 2014 08:27
Kramdown breaks some HTML entities
markdown: kramdown
@tomer
tomer / up.sh
Last active August 29, 2015 14:01
Send ps report after system restart (set as cron job to run every few minutes)
#!/bin/bash
a=`cat /proc/uptime | cut -f 1 -d "."`
b=`cat ~/previous_uptime | cut -f 1 -d "."`
cp /proc/uptime ~/previous_uptime -f
if [ "$a" -gt "$b" ]; then
# Regular behavior - Incremental times
echo >> ~/uptime_report.txt
echo >> ~/uptime_report.txt
@tomer
tomer / dabblet.css
Created August 21, 2014 14:37
Untitled
.field {
border: 1px solid silver;
min-height: 2em;
width: 50%;
display: inline-block;
font-size: 100%;
margin: 0;
padding: 0;
}
@tomer
tomer / dabblet.css
Created March 10, 2016 11:41
Untitled
body {
margin: 25px auto;
width: 200px;
text-align: center;
border: 1px gray solid;
border-radius: 25px;
box-shadow: 5px 5px 5px 5px silver;
animation: rotate 1s infinite alternate; }
@keyframes rotate {
0% { transform: translate(100px) rotate(-20deg);}
@tomer
tomer / keybase.md
Created March 15, 2016 21:31
keybase.io proof

Keybase proof

I hereby claim:

  • I am tomer on github.
  • I am tomerc (https://keybase.io/tomerc) on keybase.
  • I have a public key ASC7_CDwMtnJylalhPzo0fhAtE7mc2ctlRUpqOkKFK2-0wo

To claim this, I am signing this object:

@tomer
tomer / dec2bin.c
Last active August 6, 2016 23:05
Decimal number to binary
#include<stdio.h>
void dec2bin(int number) {
if (number == 0) return;
dec2bin(number/2);
printf ("%d", number % 2);
}
void main() {
int number;