Skip to content

Instantly share code, notes, and snippets.

View zyuiop's full-sized avatar

Louis Vialar zyuiop

  • Lausanne, Switzerland
View GitHub Profile
@zyuiop
zyuiop / pandoc-preview.sh
Created September 22, 2020 19:30
Pandoc preview: a small script that renders a preview of a markdown document through pandoc "live"
file=$1
target=.~$file.pdf
pandoc -i "$file" -o "$target"
okular "$target" &
inotifywait -q -m -e close_write "$file" |
while read -r filename event; do
import java.util.Date
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import scala.collection.mutable
import scala.io.{AnsiColor, Source}
/**
* @author Louis Vialar
@zyuiop
zyuiop / setup_blaster.sh
Last active March 14, 2018 10:30
USB Blaster setup
file=$(mktemp)
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="0666"' >> $file
sudo mv $file /etc/udev/rules.d/51-altera-usb-blaster.rules
@zyuiop
zyuiop / PhiloFinder.scala
Last active February 8, 2018 11:09
How to reach the Philosophy page on Wikipedia clicking the first link of every found page ?
package net.zyuiop.philofinder
import net.ruippeixotog.scalascraper.browser.JsoupBrowser
import net.ruippeixotog.scalascraper.dsl.DSL._
import net.ruippeixotog.scalascraper.scraper.ContentExtractors.{element, elements}
import scala.io.StdIn
/**
* @author Louis Vialar
@zyuiop
zyuiop / NotesRandomizer.scala
Created January 27, 2018 22:48
A joke I made to generate a fake CSV listing of notes mapped to student names/scipers
import java.io.PrintWriter
import scala.io.Source
import scala.util.Random
/**
* @author Louis Vialar
*/
object NotesRandomizer {
val namesAndScipers: List[String] = Source.fromFile("names.csv").getLines().map(a => a.split(";")(0)).toList
@zyuiop
zyuiop / Tempo.scala
Last active November 19, 2017 23:23
A script to sort a list of elements according to the user input
/**
* @author Louis Vialar
*/
import java.io.File
import scala.collection.immutable.Stack
import scala.io.{Source, StdIn}
object Tempo {
package ch.epfl.alpano.gui;
import ch.epfl.alpano.Math2;
import ch.epfl.alpano.PanoramaComputer;
import ch.epfl.alpano.PanoramaParameters;
import ch.epfl.alpano.dem.ContinuousElevationModel;
import ch.epfl.alpano.dem.ElevationProfile;
import ch.epfl.alpano.summit.Summit;
import javafx.scene.Node;
import javafx.scene.shape.Line;
@zyuiop
zyuiop / mult.py
Created November 10, 2016 18:24
I really thought I had found an incredible algorithm for better multiplication times. It's not the case so I think I underevaluated the time of an instruction somewhere :D
import random, math, time
def multiply(n, k):
result = 0
if k & 1 == 1:
result = n
for i in range(1, math.ceil(math.log(k, 2))): # log(k)
if (k >> i) & 1 == 1: # O(1) shift
result = result + (n << (i)) # O(log(n)) [summation] + O(1) [shift]

Keybase proof

I hereby claim:

  • I am zyuiop on github.
  • I am zyuiop (https://keybase.io/zyuiop) on keybase.
  • I have a public key whose fingerprint is 40E6 B2FB E32E AC41 8E30 E11D 24D2 39F0 A61B 9EEA

To claim this, I am signing this object:

def createServer(gametype, maps, scoreLimit, basePort, portId):
# Main
hasRotation = len(maps) > 1
filename = ""
conf = "sv_name zyuiop.net - Public "
motd = "zyuiop's public Teeworlds servers - "
if hasRotation:
conf += gametype.upper()
filename = gametype