Skip to content

Instantly share code, notes, and snippets.

View Miaourt's full-sized avatar
🏴‍☠️

Miaourt Miaourt

🏴‍☠️
View GitHub Profile
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@KokaKiwi
KokaKiwi / events.md
Last active June 18, 2024 19:24
[HOWTO] Gérer d'autres évènements avec la MinilibX

Hello, voici un petit guide pour ceux qui aimeraient savoir comment gérer des évènements autres que "KeyRelease", "ButtonPress" (souris), "Expose" et "Loop".

En effet, la minilibx ne dispose que des fonctions permettant de gérer ces évènements. Or ils ne sont pas suffisants pour faire des programmes évolués (cool un Wolf3D qui nécessite que j'appuie plusieurs fois sur la touche HAUT pour avancer!)

En fait, il faut pour cela regarder dans le code de la MinilibX et voir comment sont gérés les évènements envoyés par le serveur X.

Si vous voulez en savoir plus, regardez le fichier "mlx_int_param_events.c" ;)

Mais revenons au sujet principal: Comment gérer d'autres évènements?

@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active May 26, 2024 17:26
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@josue
josue / nginx_s3_proxy.conf
Last active March 7, 2023 07:31
Simple Nginx Proxy to S3 Bucket Asset
server {
listen 80;
listen 443 default_server ssl;
ssl on;
ssl_certificate /etc/ssl/certs/myssl.crt;
ssl_certificate_key /etc/ssl/private/myssl.key;
server_name *.example.com;
root /var/www/vhosts/website;
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active June 18, 2024 23:06
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@beginor
beginor / snowflake-id.sql
Last active May 11, 2024 18:48
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@antony
antony / SimpleFileUploader.svelte
Created September 18, 2019 16:03
File Uploader Svelte
<label>
{#if uploading}
<Progress bind:percent={progress} text="Uploading..." />
{:else if processing}
<Progress percent={100} text="Processing..." />
{:else}
<slot name="content">
</slot>
{/if}
<input
@larsneo
larsneo / viewer.html
Last active April 22, 2024 22:14 — forked from jsprpalm/viewer.html
Pinch zoom implementation for PDF.js viewer
<!-- Goes into viewer.html just before ending </body> -->
<script>
let pinchZoomEnabled = false;
function enablePinchZoom(pdfViewer) {
let startX = 0, startY = 0;
let initialPinchDistance = 0;
let pinchScale = 1;
const viewer = document.getElementById("viewer");
const container = document.getElementById("viewerContainer");
const reset = () => { startX = startY = initialPinchDistance = 0; pinchScale = 1; };
@angerman
angerman / Installation.md
Last active February 1, 2024 11:38
Installing nix on macOS BigSur

The nixos.org website suggests to use:

sh <(curl -L https://nixos.org/nix/install)

For macOS on Intel (x86_64) or Apple Silicon (arm64) based macs, we need to use

sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
@unixfox
unixfox / README.md
Last active August 29, 2023 03:52
Install alpine linux on Scaleway stardust
  1. Reboot into the rescue image
  2. Then execute these commands:
cd /dev/shm
mkdir alpine
cd alpine
wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-minirootfs-3.16.0-x86_64.tar.gz
tar xzvf alpine*
mount -t proc /proc proc/
mount -t sysfs /sys sys/