Skip to content

Instantly share code, notes, and snippets.

View cchudant's full-sized avatar
🥳
happy

cchudant

🥳
happy
  • Paris, France
  • 23:06 (UTC +02:00)
View GitHub Profile
use core::fmt;
use serde::de::DeserializeSeed;
use serde::ser::SerializeTuple;
use serde::Deserializer;
use serde::Serializer;
use serde::{de, Deserialize, Serialize};
const COMPRESSED: u8 = 0b1000_0000;
#[derive(PartialEq, Debug, Copy, Clone)]
@cchudant
cchudant / main.c
Created January 20, 2022 17:42
clang -S -emit-llvm main.c
#include <stdio.h>
int factorial(int n, int p) {
int res = 1;
for (int i = 0; i < p; i++) {
res *= n;
}
return res;
}
import { createContext, useContext } from 'react'
interface User {
name: string
}
interface UserContext {
value?: User
setCurrentUser: (value: User) => void
}
@cchudant
cchudant / .zshrc
Created September 6, 2021 12:31
42 zshrc
export ZSH="/Users/cchudant/.oh-my-zsh"
precmd() {}
ZSH_THEME="bira"
plugins=(git chucknorris)
source $ZSH/oh-my-zsh.sh
@cchudant
cchudant / Constants.cpp
Created October 9, 2020 10:40
webserv constants
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Constants.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: skybt <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/19 15:11:17 by skybt #+# #+# */
/* Updated: 2020/04/07 02:45:57 by skybt ### ########.fr */
/* */
import os
from Xlib.display import Display
from Xlib.xobject.drawable import Window
from Xlib.protocol.event import ClientMessage
from Xlib import X
from collections import namedtuple
WindowGeometry = namedtuple('WindowGeometry', 'x y width height')
WindowPosition = namedtuple('WindowPosition', 'x y')
@cchudant
cchudant / 1-sugar.rs
Last active May 9, 2020 15:55
Async await desugar (kind of)
async fn unicorn(arg: i32) {
println!("Hi!");
do_things().await;
println!("Hi x2!");
for i in arg..5 {
let num = do_other_things().await;
println!("Future {} returned {}!", i, num);
}
}
const ROWS = 10
const COLS = 10
const N = 20
const TABLE = [
':zero:', ':one:', ':two:', ':three:', ':four:',
':five:', ':six:', ':seven:', ':eight:',
]
const BOMB = ':bomb:'

Here is how to install Kubernetes on the computers at 42.

Install brew

If you do not have brew installed, install it with:

rm -rf $HOME/.brew && git clone --depth=1 https://github.com/Homebrew/brew $HOME/.brew && \
  echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && \
  source $HOME/.zshrc && \
 brew update
@cchudant
cchudant / timings.h
Last active November 29, 2019 06:10
#include <time.h>
#define TIME(CALL) ({ \
clock_t _t = clock(); \
{ CALL; } \
printf("[timings]: \"%s\" took %fms\n", #CALL, \
((double)(clock() - _t)) / CLOCKS_PER_SEC * 1000.); \
})