This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# default.nix | |
with import <nixpkgs> {}; | |
stdenv.mkDerivation { | |
name = "dev-environment"; # Probably put a more meaningful name here | |
buildInputs = [ | |
pkg-config | |
clion | |
criterion | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
,%. ,. | |
.%%%%%, , /////. | |
.#%%%%%%%%* /(/// (////////, | |
##%##########///(////((((/(((((((((, | |
(#################////((((((((((((((((((* | |
/#####################(((((((((((((((((((((((, | |
* (##, .((####% .(( /((((/,((* | |
,#((# //(((((#, #(. %##% .##(((/ ((((###(( ,((* | |
.(((((((( ((((((((, ((##. %%% .###### ######## ,##* | |
.(((((((((((( (((. ####, %%% .###### ######( ./ *###(. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xrandr -o inverted |
NewerOlder