Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Compiling

julien Lengrand-Lambert jlengrand

💭
Compiling
View GitHub Profile
@jlengrand
jlengrand / .bash_aliases pour bilou
Last active Aug 29, 2015
.bash_aliases pour bilou
View .bash_aliases pour bilou
#putting my aliases here
alias cb="mv -ft ~/.local/share/Trash/files --backup=t"
alias trouve="find ./ -name .svn -prune -o -type f -print | xargs grep -Hi"
alias updg="sudo apt-get update; sudo apt-get upgrade"
alias pc_clean="sudo apt-get clean; sudo apt-get autoremove"
alias st="svn status -u --no-ignore"
alias svnrm="find -name .svn -exec rm -rf {} \;"
alias rmcb="rm -rf ~/.local/share/Trash/files "
alias unlog="gnome-session-save --force-logout"
@jlengrand
jlengrand / .bashrc
Last active Aug 29, 2015
.bashrc pour bilou
View .bashrc
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
source ~/.rvm/scripts/rvm
export PS1="\[\033[0;31m\][\u@\h:\w]$\[\033[0m\] "
#adding my own scripts
export PATH="$PATH:$HOME/bin"
@jlengrand
jlengrand / octocat.py
Created May 10, 2014
Get the latest octocat
View octocat.py
from bs4 import BeautifulSoup
import urllib2
url = "http://feeds.feedburner.com/Octocats"
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content)
print soup.find("img")["src"]
View extract
#!/bin/bash
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvJf $1 ;;
*.bz2) bunzip2 $1 ;;
View keybase.md

Keybase proof

I hereby claim:

  • I am jlengrand on github.
  • I am jlengrand (https://keybase.io/jlengrand) on keybase.
  • I have a public key ASBOPLSHLfuup2FQb9eaoKIljG0q1LIqAesn4cYTaeiJQwo

To claim this, I am signing this object:

View service-worker.js
"use strict";
var precacheConfig = [
["/index.html", "6633bcbb6d392a7d68be37924b341845"],
["/static/js/main.f95e1c59.chunk.js", "559581975d6026fccabb204f217e44db"],
["/static/js/runtime~main.1b922744.js", "13a6cba6703084ad6f60a3db941db615"],
["/static/js/vendors~main.3ca81432.chunk.js", "86fba34edc08a61c670b6c7527e6b813"]
],
cacheName = "sw-precache-v3-sw-precache-webpack-plugin-" + (self.registration ? self.registration.scope : ""),
ignoreUrlParametersMatching = [/^utm_/],
addDirectoryIndex = function(e, n) {
@jlengrand
jlengrand / transaction.kotlin
Last active Mar 19, 2020
Transcations split in Exposed
View transaction.kotlin
private fun loadData(db : Database, table: Table, fileName: String, partitions: Int, operation: BatchInsertStatement.(String) -> Unit){
val reader = File(fileName).bufferedReader()
reader.readLine() // pass headers
val lines = reader.readLines()
val partitionSize = lines.size / partitions
val listOfLists = lines.chunked(partitionSize)
var increment = 0
View titlesandratings.kotlin
object Ratings : IntIdTable(){
val tconst : Column<String> = varchar("tconst", 10).uniqueIndex()
val averageRating : Column<Float?> = float("averageRating").nullable()
val numVotes : Column<Int?> = integer("numVotes").nullable()
}
object Titles : IntIdTable() {
val tconst : Column<String> = varchar("tconst", 10).uniqueIndex()
val titleType: Column<String> = varchar("titleType", 50) // TODO: Own Table?
val primaryTitle: Column<String> = varchar("primaryTitle", 500)
View referenceTitleAndRating
val tconst: Column<String> = (varchar("tconst", 10) references Ratings.tconst).uniqueIndex()
View queryBatmanByRating.kotlin
println("Ratings query took : ${measureTimeMillis() {
transaction(db) {
var result = (Titles innerJoin Ratings).slice(Titles.primaryTitle, Titles.titleType, Ratings.averageRating, Ratings.numVotes).select {
((Titles.primaryTitle like "%batman%") and (Titles.titleType like "movie")
and Titles.tconst.eq(Ratings.tconst))
}.orderBy(Ratings.averageRating)
.toList()
println(result.size)
println(result)