Skip to content

Instantly share code, notes, and snippets.

View lovasoa's full-sized avatar
🎯
Focusing

Ophir LOJKINE lovasoa

🎯
Focusing
View GitHub Profile
@lovasoa
lovasoa / README.md
Last active December 5, 2019 10:43
Stitch images from a zoomify viewer. Mainly Javascript, and some PHP
@lovasoa
lovasoa / README.markdown
Last active January 25, 2020 01:05
The dezoomify script is capable of grabbing images from a webpage containing a Zoomify viewer and automatically stitching the images with javascript and the HTML5 <canvas> element.

Dezoomify

Out of date

This gist is out of date The project now has a true git repository: https://github.com/lovasoa/dezoomify

Reassemble tiles of a zoomify-powered image

This script makes one downloadable image from an image viewable via a flash zoomify interface.

@lovasoa
lovasoa / phone_keyboard.py
Created December 10, 2011 13:41
Optimal keyboard layout for phones with 10 keys
#!/usr/bin/python
#-*-coding:utf8-*-
#Algorithme de recherche du clavier de téléphone portable (à 10 touches) optimal. Un clavier est optimal lorsque l'on a rarement besoin d'utiliser deux fois de suite la même touche.
#On considère ici que la saisie prédictive (T9) n'est pas activée
#Par Ophir LOJKINE
texte = open("texte.txt").read().decode('utf8').lower()
@lovasoa
lovasoa / polynome.rb
Created February 3, 2012 22:01
polygnome
# Classe principale
# Retourne 0 si nil, nombre sinon
def obj2nbr(obj)
return (obj == nil) ? 0 : obj
end
class Polynome
require 'rational'
@lovasoa
lovasoa / README.md
Last active June 30, 2021 16:23
ODT to HTML conversion

#Ophir.php

Important note

This code is not up to date. It is now hosted at https://github.com/lovasoa/ophir.php

PHP script that converts ODT to HTML

ophir.php is a lightweight script that parses an open document file and outputs a simple HTML file, with very few tags (contrarily to most other tools that do the same).

Features

Currently, the script parses bold (b tag), italic (i tag), underline (u tag), quotations (blockquote tag), images (using data URIs), links, headings (h1, h2, ...), lists (ul and li), tables (table tr and td) annotations and footnotes.
@lovasoa
lovasoa / README.md
Created March 18, 2012 23:02
Masterpendu

Masterpendu

Le jeu de masterpendu est un mélange de mastermind et de pendu. L'ordinateur choisit un mot, et vous devez le deviner. A chaque proposition, l'ordinateur donne le nombre de lettres bien placées, et le nombre de lettres correctes, mais mal placées. Le mot choisi par l'ordinateur est forcément un mot correct en français, mais l'utilisateur peut lui soumettre n'importe quelle combinaison de lettres qu'il estime utile pour sa réflexion.

@lovasoa
lovasoa / primefactor.c
Last active October 2, 2015 08:28
Find prime factors of a given integer
/* prime factors
by ophir lojkine
*/
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
@lovasoa
lovasoa / bin.c
Last active October 5, 2015 08:27
Simple bit manipulation
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv) {
unsigned char byte;
unsigned char i;
FILE *fi = stdin;
FILE *fo = stdout;
if (fi==NULL || fo==NULL) return 1;
@lovasoa
lovasoa / ophriends.py
Created June 25, 2012 15:06
Ophriends : statistics on the Android SMS database (mmssms.db) to know how unbalanced your relationships are.
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sqlite3, sys, re
con = sqlite3.connect("mmssms.db")
cur = con.cursor()
req = """
SELECT
@lovasoa
lovasoa / ArrayBufferToBase64.js
Last active October 7, 2015 23:37
Javascript function that converts an ArrayBuffer to a base64-encoded string
function ArrayBufferToBase64 (buff) {
var alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
enc = "",
n,p,bits;
d=new Uint8Array(buff);
var len = buff.byteLength*8;
for (var offset=0; offset<len; offset+=6){
n = (offset/8)|0;
p = offset%8;
bits = ((d[n]||0)<<p)>>2;