Skip to content

Instantly share code, notes, and snippets.

View Horace89's full-sized avatar
๐Ÿš€
code addict

Horace89 Horace89

๐Ÿš€
code addict
  • http://www.inspeer.com
  • Paris, France
View GitHub Profile
@Horace89
Horace89 / euler.py
Last active September 24, 2025 08:17
How can we get the Euler angles from a rotation matrix
import cv2
import numpy as np
# Example: Get Euler angles from a rotation matrix
rot_vec = np.array([0.1, 0.2, 0.3]) # Example rotation vector
rmat, _ = cv2.Rodrigues(rot_vec)
# Decompose the rotation matrix into Euler angles
angles, mtxR, mtxQ, Qx, Qy, Qz = cv2.RQDecomp3x3(rmat)
from PIL import Image
import numpy as np
with Image.open("cover-secret.png") as img:
width, height = img.size
data = np.array(img)
data = np.reshape(data, width*height*3)
# extract lsb
data = data & 1
import numpy as np
from PIL import Image
message = "Hello World!"
# Encode the message in a serie of 8-bit values
b_message = ''.join(["{:08b}".format(ord(x)) for x in message ])
b_message = [int(x) for x in b_message]
b_message_lenght = len(b_message)
@Horace89
Horace89 / pandas_image.ipynb
Created June 12, 2024 07:55 — forked from stas-sl/pandas_image.ipynb
Displaying inline images in pandas DataFrame
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Horace89
Horace89 / ladder.md
Created January 17, 2024 14:40 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
@Horace89
Horace89 / Pipfile
Created January 11, 2024 16:22 — forked from tribals/Pipfile
Understanding SQL row locking - `SELECT FOR UPDATE`
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
SQLAlchemy = "*"
"psycopg2-binary" = "*"
[dev-packages]
@Horace89
Horace89 / bloomfilter.py
Created September 20, 2021 09:12 — forked from mburst/bloomfilter.py
Code for creating and testing a simple bloom filter - http://maxburstein.com/blog/creating-a-simple-bloom-filter/
from bitarray import bitarray
import mmh3
class BloomFilter:
def __init__(self, size, hash_count):
self.size = size
self.hash_count = hash_count
self.bit_array = bitarray(size)
self.bit_array.setall(0)
@Horace89
Horace89 / random_bijection.py
Created May 3, 2019 08:07
lazily generated bijection
#https://stackoverflow.com/questions/51412182/iteratively-generating-a-permutation-of-natural-numbers/51429458#51429458
''' Format preserving encryption using a Feistel network
This code is *not* suitable for cryptographic use.
See https://en.wikipedia.org/wiki/Format-preserving_encryption
https://en.wikipedia.org/wiki/Feistel_cipher
http://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
@Horace89
Horace89 / raspi-setup-gitea.md
Created March 7, 2018 09:36 — forked from mirhec/raspi-setup-gitea.md
Installing Gitea on Raspberry Pi with nginx, SSL and automatic backups

Setup Gitea on Raspberry Pi (3)

These instructions are based on this article: https://www.alexruf.net/2016/05/23/setup-gogs-git-service.html.

Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:

sudo raspi-config

There you need to enable the SSH server and you should change the hostname.

@Horace89
Horace89 / image-downloader2.py
Created February 5, 2018 07:55 — forked from davesnowdon/image-downloader2.py
Rewrite of the python image downloading code from https://www.pyimagesearch.com/2017/12/04/how-to-create-a-deep-learning-dataset-using-google-images/ which does not leave gaps in the numbering, allows arbitrary starting numbers and uses generators to make the code a bit more readable
from imutils import paths
import argparse
import requests
import cv2
import os
import numpy as np
# Adapted from https://www.pyimagesearch.com/2017/12/04/how-to-create-a-deep-learning-dataset-using-google-images/
# fixes the following issues with the original:
# 1 - files are always saved as .jpg even if they are not in JPEG format