Skip to content

Instantly share code, notes, and snippets.

View aliva's full-sized avatar
🤖
Hello Humans!

Ali Vakilzade aliva

🤖
Hello Humans!
View GitHub Profile
@aliva
aliva / html2markdown.sh
Created March 22, 2012 10:11
convert all html files in a directory to markdown
# uses http://github.com/aaronsw/html2text
HTML2TEXT=~/bin/html2text/html2text.py
for f in `find | grep html$ | cut -b 3-`
do
echo $f
$HTML2TEXT $f > ${f%.html}.md
# rm $f
done
@aliva
aliva / move-cursor-linux.cpp
Created August 16, 2012 18:17
move mouse pointer to given position in linux
#include <X11/Xlib.h>
#include <iostream>
#include <unistd.h>
int main(void) {
Display* dpy = XOpenDisplay(0);
int scr = XDefaultScreen(dpy);
Window root_window = XRootWindow(dpy, scr);
int height = DisplayHeight(dpy, scr);
@aliva
aliva / calculator.py
Created December 27, 2012 15:01
a very simple calculator with kiviy for class
import kivy
kivy.require('1.0.6') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
class MyApp(App):
@aliva
aliva / timer.py
Created December 27, 2012 15:02
a very simple timer with kivy
import kivy
kivy.require('1.0.6') # replace with your current kivy version !
import datetime
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.image import Image
@aliva
aliva / genetic.py
Created April 10, 2013 15:34
solve n-queens with genetic algorithm
#!/usr/bin/python3
import sys
import copy
import math
import random
class Board:
def __init__(self, board_size, goal):
''' initialize a board'''
self.board_size = board_size
@aliva
aliva / 4.asm
Last active December 16, 2015 06:09
z80 code for class lab 4
JP 1800H
ORG 1800H
MAIN:
CALL DISPLAY
CALL TOUCH
JP MAIN
HLT
ORG 1850H
@aliva
aliva / video.sh
Created October 9, 2013 19:45 — forked from psamim/wget.sh
#!/usr/bin/env bash
[email protected]
YD_DIR="app-root/data"
DIR="video"
if [ "$1" == "install" ]
then
# SSH To Server
ssh $SSH_ACCOUNT 'bash -s'<<<"
wget https://yt-dl.org/downloads/2013.10.07/youtube-dl -O \$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl --no-check-certificate
@aliva
aliva / rhythmbox_db_sync_lastfm.py
Last active August 29, 2015 13:56
sync rhythmboxdb.xml with last.fm info (play count/rating)
#!/usr/bin/python3
import json
import os
from datetime import datetime
from shutil import copy
from urllib.error import HTTPError
from urllib.request import quote
from urllib.request import urlopen
from xml.etree import ElementTree
@aliva
aliva / rmrf.php
Last active August 29, 2015 14:14
rm -rf on php
<?php
function rmTree($path){
$pathes = array($path);
while(true){
if (count($pathes) == 0){
break;
}
$path = array_pop($pathes);
#!/bin/sh
for i in `ls`
do
echo $i
# actions
done