Skip to content

Instantly share code, notes, and snippets.

@jkbradley
jkbradley / benchm-ml-spark
Created September 8, 2015 23:58
Running benchm-ml benchmark for random forest on Spark, using soft predictions to get better AUC
Here are 2 code snippets:
(1) Compute one-hot encoded data for Spark, using the data generated by https://github.com/szilard/benchm-ml/blob/master/0-init/2-gendata.txt
(2) Run MLlib, computing soft predictions by hand.
I ran these with Spark 1.4, and they should work for 1.5 as well.
Note: There's no real need to switch to DataFrames yet for benchmarking. Both the RDD and DataFrame APIs use the same underlying implementation. (I hope to improve on that in Spark 1.6 if there is time.)
Ran on EC2 cluster with 4 workers with 9.6GB memory each, and 8 partitions for training RDD.
For the 1M dataset, training the forest took 2080.814977193 sec and achieved AUC 0.7129779357732448 on the test set.
@ErneX
ErneX / gist:6859700
Created October 6, 2013 22:02
iMac wake on lan + remote access
Wake On Lan:
Mi router es un Comtrend y este router en particular la tabla ARP no hay manera de crear entradas permanentes desde la UI web, pero se puede via telnet. No recuerdo ahora exactamente bajo cuales circunstancias se olvidaba de las entradas ARP que se creaban automáticamente, creo que si reiniciabas el router las perdía o algo. Entonces busqué la manera de recrear estas entradas de forma automática periódicamente mediante un script para que estuviesen al día y poder enviar el magic packet y que el router supiese a cual ordenador pasarlo.
La solución con la que he dado es esta:
1.
Instalar SleepWatcher http://www.bernhard-baehr.de es un programa que lo instalas con launchd y te permite ejecutar scripts cuando el ordenador se duerme o despierta.
2.
@skyriverbend
skyriverbend / rails_switch_branch.py
Created November 15, 2012 05:54
Rails: Switch branches and run migrations
#!/usr/local/bin/python
"""
To use this script, you must be in the root directory of a Rails project that
is using git. You should also make sure that your directory does not contain any
uncommitted changes. Then run:
$ python rails_switch_branch.py name_of_another_branch
Running the above will do the following: