Skip to content

Instantly share code, notes, and snippets.

Fräntz Miccoli frantzmiccoli

Block or report user

Report or block frantzmiccoli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Funny hashing
echo "<?php echo password_hash('hello', PASSWORD_DEFAULT); echo \"\n\";" > test.php; php test.php; php test.php
@frantzmiccoli
frantzmiccoli / localsync
Last active May 30, 2019
Dirty little script
View localsync
#!/usr/local/bin/python --
# -*- coding: utf-8 -*-
from paver.easy import sh
import os
import sys
clear_flag = '--clear'
def local_sync():
@frantzmiccoli
frantzmiccoli / associative-sort.php
Created Dec 10, 2018
Just a quick demo highlighting that PHP doesn't preserve same-value keys order while running an associative sort
View associative-sort.php
<?php
$a = [];
$threshold = 120;
while (count($a) < 400) {
$v = count($a) > $threshold ? 'a' : 'b';
$a[] = $v;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am frantzmiccoli on github.
  • I am frantzmiccoli (https://keybase.io/frantzmiccoli) on keybase.
  • I have a public key ASAiqAa7ifmI-TxwqgucIKM8TbsMEkNDJwDaGPuzmtzMZwo

To claim this, I am signing this object:

@frantzmiccoli
frantzmiccoli / filtered-cities.zsh
Last active Aug 29, 2015
Cities filtered by size
View filtered-cities.zsh
# Data source https://www.maxmind.com/en/worldcities
# Using https://github.com/Russell91/pythonpy
# We first extract the cities with more than 500000 inhabitants
# We then filter those in relevant countries
# We generate a string close to json from the output
cat worldcitiespop.txt|py -fx --i '(int(x.split(",")[4]) > 500000)'|\
py -fx "x.split(',').pop(0) in ['us', 'it', 'es', 'pt', 'gb', 'ie', 'is', 'it', 'fr', 'ca', 'be', 'de', 'at', 'dk', 'se', 'fi', 'nl', 'no', 'ch', 'en','lu', 'pl']" |\
py -x "json.dumps({'name': x.split(',')[2], 'latitude': float(x.split(',')[5]), 'longitude': float(x.split(',')[6])}, indent=4, sort_keys=True)+','"
@frantzmiccoli
frantzmiccoli / richvspoorurbanareas.js
Last active Aug 29, 2015
Splitting world's biggest urban area between rich and poor to compute a sum of those population.
View richvspoorurbanareas.js
// Run me on http://en.wikipedia.org/wiki/List_of_metropolitan_areas_by_population
// from http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery
var getTextNodesIn = function($el) {
return $($el.find(":not(iframe)").addBack().contents().filter(function() {
return this.nodeType == 3;
}).get(0)).text();
};
var rowsSelector = '#bodyContent .sortable.wikitable.jquery-tablesorter tr',
@frantzmiccoli
frantzmiccoli / extractdatafrombiggestcities in the world
Last active Aug 29, 2015
A small script that extract population and data from Wikipedia's list of biggest cities, it can be easily adapted for other pages and other informations.
View extractdatafrombiggestcities in the world
// Run me in your console on http://en.wikipedia.org/wiki/List_of_cities_proper_by_population
// from http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery
var getTextNodesIn = function($el) {
return $($el.find(":not(iframe)").addBack().contents().filter(function() {
return this.nodeType == 3;
}).get(0)).text();
};
var rowsSelector = '#bodyContent .sortable.wikitable.jquery-tablesorter tr',
@frantzmiccoli
frantzmiccoli / imgccsearch
Last active Jul 6, 2016
Looking at creative commons pictures and tired of switching doing the same things to test all licenses and all sites? This small script is for you. It looks on 500px, Flickr and many cool other ones
View imgccsearch
#!/usr/bin/env zsh
# Usage: 'imgccsearch "beautiful pictures"'
term=$1
open "https://500px.com/search?q=$term&type=photos&ccLicense=by&sort=relevance"
open "https://500px.com/search?q=$term&type=photos&ccLicense=by-nc&sort=relevance"
open "https://500px.com/search?q=$term&type=photos&ccLicense=by-sa&sort=relevance"
open "https://500px.com/search?q=$term&type=photos&ccLicense=by-nd&sort=relevance"
open "https://500px.com/search?q=$term&type=photos&ccLicense=by-nc-sa&sort=relevance"
@frantzmiccoli
frantzmiccoli / check-ovh-sold-out.sh
Last active Dec 29, 2015
OVH Sold Out helper. A 2 cents bash script to help you monitor when OVH sold-out will finally end. It works on Mac OSX Mountain Lion, it needs to be tested/adapted for other OS.
View check-ovh-sold-out.sh
#!/bin/bash --
# To use it
# watch -n 15 check-ovh-sold-out.sh
if r=`curl http://www.ovh.com/fr/serveurs_dedies/|grep mSP|grep -s -m 1 "Sold Out"`
then
echo "Found this wonderful sold out message!"
else
message="OVH is back in business"
You can’t perform that action at this time.