Skip to content

Instantly share code, notes, and snippets.

View Vinetos's full-sized avatar
⌨️
I don't code... I think ?

Valentin Vinetos

⌨️
I don't code... I think ?
View GitHub Profile
@Vinetos
Vinetos / tp2.py
Last active November 27, 2023 14:22
custom_lock = "SELECT pg_advisory_xact_lock(%s);"
def lock(conn, lock_key):
cur = conn.cursor()
try:
# Acquire the custom lock outside of the transaction
cur.execute(custom_lock, (lock_key,))
conn.commit()
except Exception as e:
# Handle exceptions
@Vinetos
Vinetos / install.sh
Created September 27, 2022 15:12
Install Gitlab EE on Ubuntu 22.04
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.mineofwar.com" apt-get install gitlab-ee
@Vinetos
Vinetos / jupyter.nix
Last active December 17, 2021 10:30
Jupyer NoteBook on NixOS with Numpy and matplotlib
with import <nixpkgs> {};
mkShell {
buildInputs = [
# Defines a python + set of packages.
(python3.withPackages (ps: with ps; with python3Packages; [
jupyter
ipython
# Uncomment the following lines to make them available in the shell.
# default.nix
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "dev-environment"; # Probably put a more meaningful name here
buildInputs = [
pkg-config
clion
criterion
];
}
cmake_minimum_required(VERSION 3.19)
project(malloc C)
set(CMAKE_C_STANDARD 99)
add_executable(malloc src/malloc.c src/struct.c src/struct.h)
,%. ,.
.%%%%%, , /////.
.#%%%%%%%%* /(/// (////////,
##%##########///(////((((/(((((((((,
(#################////((((((((((((((((((*
/#####################(((((((((((((((((((((((,
* (##, .((####% .(( /((((/,((*
,#((# //(((((#, #(. %##% .##(((/ ((((###(( ,((*
.(((((((( ((((((((, ((##. %%% .###### ######## ,##*
.(((((((((((( (((. ####, %%% .###### ######( ./ *###(.
# 0. ON WINDOWS :
# On windows, to check which WSL you use, type ` wsl --list --verbose ` in admin cmd.
# If you are not in WSL2, reinstall the machine with WSL2 : https://docs.microsoft.com/fr-fr/windows/wsl/install-win10
# 1. Make sure you are running with systemd
# sudo systemctl must not say "Failed to connect to bus"
# If so, I recommand you to reinstall the VM. You can try this repo too : https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
# 2. On WSL2 machine
# /!\ Create an user with A PASSWORD and with sudo access
@Vinetos
Vinetos / otsu.c
Created October 24, 2020 19:28
Otsu algorithm usin SDL in C
#include <err.h>
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
static inline
Uint8* pixel_ref(SDL_Surface *surf, unsigned x, unsigned y)
{
int bpp = surf->format->BytesPerPixel;
return (Uint8*)surf->pixels + y * surf->pitch + x * bpp;
}
@Vinetos
Vinetos / install.sh
Last active November 7, 2020 13:32
Install OASIS for AFIT at EPITA
# First, Install opam as described here : https://opam.ocaml.org/doc/Install.html
# Run in the directory for caml you downloaded
opam init
eval $(opam env)
# Switch changement (if asking or not up to date)
# opam update
# opamn switch create ocaml-base-compiler
opam install oasis
xrandr -o inverted