Skip to content

Instantly share code, notes, and snippets.

View AdrienLemaire's full-sized avatar

Adrien Lemaire AdrienLemaire

View GitHub Profile
@AdrienLemaire
AdrienLemaire / benchmark_ndarray_N_highest_vals_indices.py
Last active November 11, 2017 16:24
Benchmark 2 methods to get the indices for a multi-dimensional array N highest values
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $ benchmark.py
#
# Test with test_argpartition:
# Results:
# [[78 55 72]
# [ 0 50 15]
# [ 8 44 27]
@AdrienLemaire
AdrienLemaire / get_mem_for_item.py
Created November 13, 2014 07:56
[Memrise] Get Mnemonic url for word id
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
Find your item id (by looking at your webpage source), and query as follow:
$ ./get_mem_for_item.py -i 41006508
http://www.memrise.com/mem/4321815/i-intend-to-become-a-lawyer/
$
@AdrienLemaire
AdrienLemaire / autocast_mana.js
Created August 1, 2015 03:44
Habitica Auto-cast mana
s=angular.element($0).scope();for(i=0;i<s.user.stats.mp/s.skill.mana;i+=1){setTimeout(function(){s.castStart(s.skill);},i*2000);}
@AdrienLemaire
AdrienLemaire / autofeed_pets.js
Last active August 29, 2015 14:26
Habitica Auto-feed pets
window.confirm=function(){return true};$.each($(".pet-button"),function(){s=$(this).scope();if(!s.cp){s.cp=s.choosePet.bind({});s.choosePet=function(e,p){f=s.selectedFood.key;nb=Math.min((50-s.user.items.pets[e+"-"+p])/5,s.user.items.food[f]);for(i=0;i<nb;i+=1){s.cp(e,p);s.chooseFood(f)}}}})
@AdrienLemaire
AdrienLemaire / blind_injection_sqli9
Created September 17, 2015 08:19
using the benchmark sql function to blindly find the right password
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
$ ./sqli9_bf.py
The password is 'bfmoisitupeux'
"""
@AdrienLemaire
AdrienLemaire / sqli8_blind_injection.py
Last active September 19, 2015 03:12
Blindly retrieve table, columns and rows informations in a database with bitwise comparisons
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
$ ./sqli8_blind_injection.py -u http://172.28.128.3:8007/membre.php\?id\=7 -e Mickey
OtherInformation:
* idusers
-> 7,8,9,10,11
* useyourname
-> Mickey,Kenshin,Jin,Camus,Pierre
* position
# def change(array_of_denominations, amount): ==> Number of ways you can make change
# """
# change([1, 5], 6) => 2
# change([1, 5], 10) => 3
# """
def change(array_input, amount):
if amount == 0:
return 1
elif amount < 0 or len(array_input) == 0:
@AdrienLemaire
AdrienLemaire / tixit_part1.html
Last active April 12, 2017 13:08
Tixit coding primer
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>tixit</title>
<style type="text/css" media="screen">
table, input {width: 100%}
td {width: 50%}
</style>
</head>
<body>
@AdrienLemaire
AdrienLemaire / .block
Created September 14, 2017 06:43
Force Layout - Directed Graph with Customized Node and Link
license: mit
@AdrienLemaire
AdrienLemaire / .block
Created September 20, 2017 08:12
Circle Packing
license: gpl-3.0
height: 960
border: no