Skip to content

Instantly share code, notes, and snippets.

@sarim
sarim / raw2json.php
Created June 17, 2012 13:31
Converting raw dict text to json object
<?php
//This script will convert the avro autocorrect dict to json. Rifat bro already did it using textmate manually, but my approach is artistic :D
//Get the raw dict from github
$raw = file_get_contents("https://raw.github.com/omicronlab/Avro-Keyboard/master/Keyboard%20and%20Spell%20checker/autodict.dct");
//breaking the lines
$lines = explode("\n",$raw);
$arr = array();
#include "sarim.h"
int skadd(int a,int b){
return a + b;
}
#include<stdio.h>
#include "sarim.h"
int main()
{
printf("Hello world");
int k = skadd(1,2);
printf("sum: %d",k);
return 0;
}
@sarim
sarim / README.md
Last active December 10, 2015 21:28 — forked from anonymous/README
This script copies all data from /data/data to any directory(in sdcard) and (soft)links back them in /data/data.

This script copies all data from /data/data to any directory(in sdcard) and (soft)links back them in /data/data.

The purpose is to free space from /data/data.

To use it, first make sure the DESTDIR exists, change it according to your need, mkdir it. here i used /data/sdext2 which is a ext partition on sdcard mounted by link2sd.

make sure your android is rooted and you have cp,rm,ln binary installed, usually these come from busybox.

copy the script to android,

@sarim
sarim / testscript
Created January 25, 2013 13:24
Testing PHP_EOL
#!/usr/bin/env php -q
<?php
echo 'hello'.PHP_EOL;
foobaar().PHP_EOL;
echo 'bye bye'.PHP_EOL;
function foobaar(){
echo 'my name is foo'.PHP_EOL;
}
@sarim
sarim / news.php
Created January 30, 2013 16:02
parsing news ticker from bdnews24.com
<?php
$html = file_get_contents("http://bangla.bdnews24.com/");
$doc = new DOMDocument();
$doc->loadHTML($html);
$elements = $doc->getElementById("breaking")->getElementsByTagName("div")->item(0)->getElementsByTagName('a');
foreach ($elements as $element) {
$news = $element->nodeValue;
$newslink = $element->getAttribute('href');
layout title date comments categories
post
la la la
2013-03-09 02:42
true
octopress, jekyll

So, I just installed octopress and published a hello world post.

@sarim
sarim / gist:5124646
Last active December 14, 2015 17:49
liquidsoap script for icecast
#!/usr/bin/liquidsoap
output.icecast(%mp3, host = "example_host", port = 8000, password = "source_password", mount = "gittu", input.pulseaudio(device = "stream.monitor"))
@sarim
sarim / aria2.conf
Created April 15, 2013 11:01
aria2 config for better speed. $HOME/.aria2/aria2.conf
min-split-size=1M
max-connection-per-server=8
split=8
@sarim
sarim / prettydf.sh
Created May 22, 2013 15:04
Pretty Disk Usage
#!/bin/sh
function print_bar {
GDONE=$1
GPROG='['
for i in $(seq 1 1 $GDONE)
do
GPROG=$GPROG'#'
done