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 / 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:
@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 / 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 / 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 / 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 / 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