Skip to content

Instantly share code, notes, and snippets.

View betrisey's full-sized avatar

Samuel Bétrisey betrisey

View GitHub Profile
@stefanfoulis
stefanfoulis / findauthors.sh
Created April 8, 2011 12:37
How to sync svn to git
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
@0xced
0xced / tsr_download.py
Created April 27, 2011 08:57
Download TSR medias
#!/usr/bin/env python
import json, os, subprocess, sys, urllib2
from termcolor import cprint
from xml.dom import minidom
def abort(error):
cprint(error, color='red', file=sys.stderr)
exit(1)
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 5, 2024 13:30
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@aspyct
aspyct / workaround.php
Created August 22, 2012 16:10
The most undebuggable PHP snippet ever
<?php
define("true ", false);
function doIt() {
define(" false", true);
define("maybe", rand() & 1);
}
function  ($stupid="clever") {
if (assert_value($stupid)) {
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@wolakRafal
wolakRafal / streams_.classpath
Created November 4, 2013 14:05
scala assigment bloxorz
<classpath>
<classpathentry output="target/scala-2.10/classes" path="src/main/scala" kind="src"></classpathentry>
<classpathentry output="target/scala-2.10/test-classes" path="src/test/scala" kind="src"></classpathentry>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"></classpathentry>
<classpathentry path="./lib_managed/jars/org.scalatest/scalatest_2.10/scalatest_2.10-1.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="./lib_managed/jars/org.scala-lang/scala-actors/scala-actors-2.10.0.jar" kind="lib"></classpathentry>
<classpathentry path="./lib_managed/jars/org.scala-lang/scala-reflect/scala-reflect-2.10.0.jar" kind="lib"></classpathentry>
<classpathentry path="./lib_managed/jars/junit/junit/junit-4.10.jar" kind="lib"></classpathentry>
<classpathentry path="./lib_managed/jars/org.hamcrest/hamcrest-core/hamcrest-core-1.1.jar" kind="lib"></classpathentry>
<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"></classpathentry>
@floptwo
floptwo / php-cli_ovh_mutu.md
Last active April 25, 2023 08:40
OVH PHP-CLI

PHP-CLI (PHP en ligne de commande) sur les hébergements mutualisés OVH

More complete info here http://cluster015.ovh.net/infos/ (thanks to @42antoine)

(cli)

/usr/local/php5.3/bin/php => PHP 5.3.29 (cli) (built: Nov 21 2017 08:55:07)
/usr/local/php5.4/bin/php => PHP 5.4.45 (cli) (built: Nov 21 2017 08:35:51)
/usr/local/php5.5/bin/php => PHP 5.5.38 (cli) (built: Nov 21 2017 08:46:45)
@betrisey
betrisey / itunes-festival.sh
Last active December 10, 2020 01:27
iTunes Festival - Download recordings
  1. Get your cookie. Either proxy your iPhone/iPod/iPad and record the cookie using the proxy server of your choice or capture the request using your AP with Wireshark or similar

  2. Make sure you have a cookie like token=expires=1409714101~access=/auth/*~md5=2d4466c1...

  3. Find the day of the artist you want to load (e.g. 01, 02, 10, 25) Find the artist on iTunes https://itunes.apple.com/us/artist/*deadmau5*/id*78011850* and take its ID and its name. Add an underscore between these two. (e.g. 78011850_deadmau5)

  4. Launch the script: sh itunes-festival.sh cookie day id_artist

    sh itunes-festival.sh "token=expires=1409714101~access=/auth/*~md5=2d4466c1" 01 78011850_deadmau5

  5. Have fun.

@pathikrit
pathikrit / SudokuSolver.scala
Last active April 12, 2024 15:00
Sudoku Solver in Scala
val n = 9
val s = Math.sqrt(n).toInt
type Board = IndexedSeq[IndexedSeq[Int]]
def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match {
case (r, `n`) => Some(board)
case (r, c) if board(r)(c) > 0 => solve(board, cell + 1)
case (r, c) =>
def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1)
val used = board.indices.flatMap(i => Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s)))
anonymous
anonymous / untrusted-lvl7-solution.js
Created April 19, 2015 18:09
Solution to level 7 in Untrusted: http://alex.nisnevich.com/untrusted/
/*************
* colors.js *
*************
*
* You're almost at the exit. You just need to get past this
* color lock.
*
* Changing your environment is no longer enough. You must
* learn to change yourself. I've sent you a little something
* that should help with that.