Skip to content

Instantly share code, notes, and snippets.

View Julien00859's full-sized avatar
😴
425 - Too Early

Julien Castiaux Julien00859

😴
425 - Too Early
View GitHub Profile
@Julien00859
Julien00859 / secure.py
Last active August 25, 2018 05:08
Asynchrone mixted cryptography built on RSA, AES, SHA-265 and JSON
from Crypto.Cipher import AES
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
from Crypto import Random
from hashlib import sha256
import base64
import json
class async():
def crypt(self, content, crypt_key, sign_key):
@Julien00859
Julien00859 / ytPlDl.py
Created February 11, 2016 21:06
Youtube playlist download (partialy, need the user to download the youtube video with a tool like youtube-mp3)
from urllib.request import urlopen
import re
from bs4 import BeautifulSoup as bs4
import webbrowser
from mutagen.easyid3 import EasyID3
from os.path import join
lien = "https://www.youtube.com/playlist?list=PLPZappeJ88mGglSaXJ4i6_5KPI0SI_RNG"
path = "F:/Bibliothèque/Musique/Approaching Nirvana/13. Cinematic Soundscapes Vol. 2/"
artist = "Approaching Nirvana"
@Julien00859
Julien00859 / sac_a_dos.c
Created April 25, 2016 02:09
Problème du sac à dos
// Sac à dos.cpp : Defines the entry point for the console application.
//
#include "stdafx.h" // Pour printf
#include <time.h> // Pour générer de l'aléatoire et calculer le temps utilisé par la fonction
#include <stdlib.h> // Pour system("pause")
#define NBR_OBJETS 25 // Le nombre d'objets à générer
int main()
@Julien00859
Julien00859 / conkyplugin.js
Created July 7, 2016 11:13
Cookie Clicker with Conky
var Julien = function Julien() {
var ws, init, send, plugin_indice;
init = function init() {
ws = new WebSocket("ws://Julien00859.be:9000");
ws.onopen = function onopen(){
console.log("Connection established");
if (plugin_indice === void 0) plugin_indice = Game.customTickers.push(send) - 1;
else Game.customTickets[plugin_indice] = send;
}
ws.onmessage = function onmessage(data){console.log("From WebSocket:", data)}
@Julien00859
Julien00859 / open_bash_here.reg
Created August 5, 2016 23:22
Mes hacks du registre windows
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
"Extended"=""
"NoWorkingDirectory"=""
@="Ouvrir bash ici"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="C:\\\\Windows\\\\system32\\\\bash.exe --init-file <(echo -n cd /mnt/; winpath=%V; echo \"${winpath,}\" | sed -r 's/[A-Z]/\\/\\0/g' | sed -r 's/\\://')"
@Julien00859
Julien00859 / SQLAlchemyHandler.py
Last active January 4, 2017 23:27
Python logging handler for sqlite3
from sqlalchemy import Column, Integer, String, Numeric
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Log(Base):
__tablename__ = "tb_log"
id = Column(Integer, primary_key=True)
created = Column(Numeric, nullable=False)
exc_text = Column(String, nullable=True)
@Julien00859
Julien00859 / crc.py
Last active January 5, 2017 00:58
CRC Computation
ATM = 0b100000111
AAL = 0b11000110011
CCITT41 = 0b10001000000100001
IEEE802 = 0b100000100110000010001010110110101
def compute_crc(frame: bytes, crc: int = 0, poly: int = ATM) -> int:
"""Compute the CRC of the given frame
>>> crc = compute_crc(b"Hello world !")
>>> compute_crc(b"Hello world !", crc) == 0
@Julien00859
Julien00859 / snake.cs
Last active April 11, 2017 15:02
Snake with Nathan (TIC)
using System;
using System.Collections.Generic;
using System.Threading;
namespace SnakeTIC
{
struct Pos
{
public int x { get; private set; }
public int y { get; private set; }
#!/bin/bash
if [ -z $(which python3) ]; then
echo "Please install python3"
exit 1
fi
if [ -z $(which virtualenv) ]; then
echo "Please install python-virtualenv"
exit 1
@Julien00859
Julien00859 / chain.py
Last active July 24, 2018 15:07
Python wrapper around builtin functions and itertools to chain functions from left to right
"""Wrapper around builtins and itertools to chain calls"""
from itertools import *
from functools import reduce
class Chain:
def __init__(self, data):
self._data = data
# Chain methods