Skip to content

Instantly share code, notes, and snippets.

@remi-dupre
remi-dupre / exo1.py
Created January 23, 2023 19:03
Tech challenger
from collections import Counter
moves = Counter(map(int, input().split()))
max_num = max(moves.values())
min_num = min(moves.values())
max_res = max(x for x, c in moves.items() if c == max_num)
min_res = min(x for x, c in moves.items() if c == min_num)
@remi-dupre
remi-dupre / steam-ankama-launcher.sh
Last active March 14, 2024 21:29
Get Dofus running on the SteamDeck
#!/bin/bash
# Runs Ankama Launcher on a steam deck by using existing Proton runtime.
#
# /!\ You must ensure that you have a Proton instance installed through
# steam before running this script.
DOWNLOAD_URL="https://launcher.cdn.ankama.com/installers/production/Ankama%20Launcher-Setup-x86_64.AppImage"
STEAM_COMMON="/home/deck/.local/share/Steam/steamapps/common"
# Init compatdata dir
CURR_DIR=`dirname ${BASH_SOURCE[0]}`
@remi-dupre
remi-dupre / Dockerfile
Created February 10, 2022 16:24
Plex RPI4 with hardware transcoding
FROM lscr.io/linuxserver/plex AS ffmpeg-builder
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y \
libass-dev libaom-dev libxvidcore-dev libvorbis-dev libv4l-dev libx265-dev \
libx264-dev libwebp-dev libspeex-dev librtmp-dev libopus-dev \
libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev \
libsnappy-dev libsoxr-dev libssh-dev libxml2-dev gcc ffmpeg libvpx-dev
use std::io::prelude::*;
use std::{env::args, fs::File};
use swf::read_swf;
fn main() {
let swl_path = args().nth(1).expect("missing path");
let swl = {
let mut file = File::open(&swl_path).expect("can't open swl file");
from collections import Counter
def load_pg_request(path):
return {
osm_id: (key, subclass)
for osm_id, key, subclass in map(
lambda line: map(str.strip, line.split("|")), open(path)
)
}
@remi-dupre
remi-dupre / grammar.pest
Created April 30, 2020 07:57
grammar for OSM opening hours
// Grammar for opening hours description as defined in OSM wiki:
// https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification
// Time domain
input_time_domain = _{ SOI ~ time_domain ~ &EOI }
time_domain = { rule_sequence ~ ( any_rule_separator ~ rule_sequence )* }
rule_sequence = { selector_sequence ~ (space ~ rules_modifier)? }
#!/usr/bin/env python3
import gzip
import json
import os
from shapely.geometry import mapping, shape
# File for admin data outputed by Cosmogony
COSMOGONY_DATA = 'admins.json.gz'
#include <iostream>
#include <vector>
#include <set>
#include <tuple>
using namespace std;
int tree_size(int s, int parent, vector<set<int>> &G) {
int count = 1;
for(int t : G[s])
#include <iostream>
#include <vector>
#include <set>
#include <tuple>
using namespace std;
#define graph vector<set<int> >
int tree_size(int s, int parent, graph &G) {