Skip to content

Instantly share code, notes, and snippets.

View jjst's full-sized avatar
🐱

Jérémie Jost jjst

🐱
View GitHub Profile
@jjst
jjst / pixel.md
Last active August 29, 2015 14:02
ChromebookPixel

Linux on the Chromebook Pixel

These are my personal notes on how to get Linux working on the Chromebook Pixel, common issues and how to solve them. This is not a step-by-step guide.

Installing custom OSes

Override ChromeOS and wipe the whole hard drive

@jjst
jjst / vim-cheat-sheet.md
Last active August 8, 2016 21:30
Vim cheat sheet

Moving around

h,j,k,l      — move left, down, up, right
{,}          — go to previous/next paragraph (where the previous/next blank line is}
%            — go to matching brace/parens
gg           — start of file
G            — end of file
z.           — to put the line with the cursor at the center,
@jjst
jjst / colors.py
Created November 15, 2014 16:01
pi-heart
import itertools
import re
import pygame
import sys
import colorsys
import numpy as np
WHITE = ( 255, 255, 255)
if __name__ == '__main__':
@jjst
jjst / unicorn-daemon.sh
Created September 13, 2015 22:31
Running the unicorn HAT lamp as a daemon
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn-daemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Put a short description of the service here
# Description: Put a long description of the service here
@jjst
jjst / fib.py
Created November 8, 2015 19:44
fibonacci recursive
def fibonacci(n):
if n == 0:
print "finobacci(0) = 0"
return 0
elif n == 1:
print "finobacci(1) = 1"
return 1
else:
print "fibonacci(%s) = fibonacci(%s) + fibonacci(%s)" % (n, n-1, n-2)
return fibonacci(n-1) + fibonacci(n-2)
@jjst
jjst / nicestrings.py
Created February 12, 2016 20:14
nicestrings
#!/usr/bin/env python
import re
def is_nice(s):
return (len(re.findall(r"[aeiou]", s)) >= 3 and
bool(re.search(r"(\w)\1+", s)) and not
bool(re.search(r"ab|cd|pq|xy", s)))
if __name__ == "__main__":
with open('input1.txt', 'r') as f:
/**
* Created by jjst on 21/03/16.
*/
object Floors {
def main(args: Array[String]): Unit = {
Console.println(floorNumber1("())"))
Console.println(floorNumber2("())"))
Console.println(floorNumber2(""))
}
@jjst
jjst / LispParser.scala
Created April 4, 2016 19:03
A LISP parser
trait ASTElement
case class Expression(elements: ASTElement*) extends ASTElement
case class Literal[T](value: T) extends ASTElement
case class Function(name: String) extends ASTElement
object LispParser {
def main(args: Array[String]) {
val ast = parse("(first (list 1 (+ 2 3) 9))")
assert(ast ==
# Solution for https://www.hackerrank.com/challenges/game-of-throne-ii
from collections import Counter
from math import factorial as f
word = raw_input()
letter_count = [i/2 for i in Counter(word).values()]
print (f(sum(letter_count)) / (reduce(lambda acc, x: acc * f(x), letter_count, 1))) % (10**9 + 7)
@jjst
jjst / ipython.md
Last active July 17, 2021 00:13
ipython install & cheat sheet

Getting started

Install

pip install ipython

If you also wanna use the notebook: