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 / read_gzip_lines.go
Last active October 14, 2022 08:55 — forked from cathalgarvey/jlgz_dump.go
How to Read Lines from GZIP-Compressed Files in Go
package main
import (
"bufio"
"compress/gzip"
"fmt"
"io"
"log"
"os"
)
@lovasoa
lovasoa / aes.py
Last active March 1, 2023 10:08 — forked from bonsaiviking/aes.py
A simple/simplistic implementation of AES in pure Python 3
# My AES implementation
# By Daniel Miller
# Ported to python 3 by @lovasoa
def xor(s1, s2):
return bytes(a ^ b for a, b in zip(s1, s2))
class AES(object):
@lovasoa
lovasoa / mysql2sqlite.awk
Last active October 28, 2018 23:44 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/usr/bin/awk -f
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite.awk < db-mysql.sql | sqlite3 database.sqlite
# Example: $ mysqldump --no-data -u root -pMySecretPassWord myDbase | ./mysql2sqlite.awk | sqlite3 database.sqlite
@lovasoa
lovasoa / 00-MapSideJoinDistCacheTextFile
Last active November 17, 2016 01:10 — forked from airawat/00-MapSideJoinDistCacheTextFile
Map-side join example- Java code for joining two datasets - one large (tsv format), and one with lookup data (text), made available through DistributedCache
This gist demonstrates how to do a map-side join, loading one small dataset from DistributedCache into a HashMap
in memory, and joining with a larger dataset.
Includes:
---------
1. Input data and script download
2. Dataset structure review
3. Expected results
4. Mapper code
5. Driver code
@lovasoa
lovasoa / exo.py
Last active May 4, 2016 07:35 — forked from anonymous/exo.py
#!/usr/bin/env python3
def rle(s):
encode = "" # La variable qui va contenir le résultat
count = 0
current_char = ""
for c in s:
if c == current_char:
count += 1
else: # On a rencontré un nouveau caractère
from heapq import heappush, heapify, heappop
#Question1
def table_frequences(texte):
table={}
for i in texte:
if i in table:
table[i]=table[i]+1
@lovasoa
lovasoa / hoveringGridExample.elm
Created March 15, 2016 23:40 — forked from TheSeamau5/hoveringGridExample.elm
Example of hovering over a grid
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Graphics.Input exposing (..)
import Color exposing (..)
import Signal exposing (..)
import Text
import List
import Mouse