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 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] |
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
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; |
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
/** | |
* @author Louis Vialar | |
*/ | |
import java.io.File | |
import scala.collection.immutable.Stack | |
import scala.io.{Source, StdIn} | |
object Tempo { |
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 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 |
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
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 |
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
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 |
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 java.util.Date | |
import org.jsoup.Jsoup | |
import org.jsoup.nodes.Document | |
import scala.collection.mutable | |
import scala.io.{AnsiColor, Source} | |
/** | |
* @author Louis Vialar |
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
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 |
OlderNewer