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
def kth_perm(n, k): | |
res = list(range(n)) | |
for i in range(n): | |
f = math.factorial(n - i - 1) | |
s, m = divmod(k, f) | |
if m == 0 and s == 0: | |
break | |
if s > 0: | |
for j in range(i - 1 + s, i - 1, -1): | |
res[j-1], res[j] = res[j], res[j-1] |
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
#!/usr/bin/env python | |
from PIL import Image, ImageDraw, ImageFont | |
import io | |
import re | |
import requests | |
import subprocess | |
import time | |
FNAME = '/tmp/wallpaper' |
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
import ast | |
import copy | |
from pathlib import Path | |
import asttokens | |
import astunparse | |
import string | |
LOGGING_METHODS = {'debug', 'info', 'warn', 'warning', 'exception', 'error', 'fatal', 'critical'} |
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
import django | |
django.setup() | |
from problems.models import Challenge | |
from prologin.languages import Language | |
import requests | |
from pathlib import Path | |
def get_in_out(p, tests, name): | |
refs = Path(p.file_path()).rglob('ref.*') |
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
# random wallpaper | |
set $random-wall-cmd /bin/sh $HOME/.config/i3/wallpaper.sh | |
exec --no-startup-id $random-wall-cmd | |
bindsym $mod+b exec --no-startup-id $random-wall-cmd |
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
#!/bin/sh | |
main=LVDS1 | |
a=VGA1 | |
b=HDMI1 | |
dir=left | |
function on { | |
echo Switching $1 on | |
xrandr --output $1 --auto --$dir-of $main |
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
python wordreferencespeak.py \ | |
never gonna give you up \ | |
never gonna let you down \ | |
never gonna run around and desert you |
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
import asyncio | |
import binascii | |
import irc3 | |
import re | |
import requests | |
import subprocess | |
import time | |
VOICES = ["Helene", "Emma", "Electra", "DarkVadoor", "Damien", "Agnes", "Bicool", "Chut", "Melodine", "Ludovic", "Fabienne", "Eva", "Loic", "JeanJean", "John", "Matteo", "Michel", "Papi", "Philippe", "Ramboo", "Robot", "Sidoo", "Sorciere", "Yeti", "Zozo"] |
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
# -*- coding: utf-8 -*- | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.header import Header | |
import urllib.request as urllib | |
from bs4 import BeautifulSoup | |
from random import choice | |
def randomWikipediaPage(): |
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
<?php | |
require_once 'eirb-common/CAS/CAS.php'; | |
function eirb_cas_protect() { | |
phpCAS::client(CAS_VERSION_2_0, 'cas.enseirb-matmeca.fr', 443, 'cas'); | |
phpCAS::setNoCasServerValidation(); | |
phpCAS::forceAuthentication(); | |
return phpCAS::getUser(); | |
} |