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 / README.MD
Last active April 2, 2023 11:40
A simple tool to manage scoreboards in minecraft (lines up to 48 characters !). /

About

This class allow you to use a scoreboard as a sign in which you can write any text. It is designed to be used with a CraftBukkit server (or any similar variant). It uses fake teams to allow lines that are longer than usernames.

Other versions

@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
@zyuiop
zyuiop / Example.java
Created August 8, 2015 15:25
Blocking world downloader
class Example extends JavaPlugin {
public void onEnable() {
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "WDL|CONTROL");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "WDL|INIT", (s, player, bytes) -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeInt(1);
out.writeBoolean(false);
out.writeInt(1);
out.writeBoolean(false);
out.writeBoolean(false);
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]