Skip to content

Instantly share code, notes, and snippets.

@guilespi
guilespi / README.md
Created July 26, 2022 13:10 — forked from maxious/README.md
Esee/Anran 960P 180° Wireless Fisheye Panoramic CCTV Smart Camera HD WIFI Webcam IP
@guilespi
guilespi / pm.h diff update
Created July 28, 2012 02:05
Compile latest igb driver on debian squeeze 2.6.32-5-amd64
#When presented with failure
igb-3.4.8/src/igb_main.c:193: error: implicit declaration of function SET_RUNTIME_PM_OPS
#Add the following macro to
#/usr/src/linux-headers-2.6.32-5-common/include/linux/pm.h
#ifdef CONFIG_PM_RUNTIME
#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
.runtime_suspend = suspend_fn, \
.runtime_resume = resume_fn, \
@guilespi
guilespi / qstk-tutorial1.clj
Created October 29, 2012 03:05
QSTK Tutorial 1 in Clojure
(ns qstk.tutorial1
(:use [clj-time.core :exclude 'extend])
(:use clj-time.format)
(:use clj-time.coerce)
(:require incanter.io)
(:require incanter.core))
(def ^{:dynamic true} *QS* (get (System/getenv) "QS"))
(defn get-NYSE-days
@guilespi
guilespi / get_data_hardread.py
Created October 29, 2012 02:28
QSTK Reading stock info from disk
def get_data_hardread(self, ts_list, symbol_list, data_item, verbose=False, bIncDelist=False):
'''
Read data into a DataFrame no matter what.
@param ts_list: List of timestamps for which the data values are needed. Timestamps must be sorted.
@param symbol_list: The list of symbols for which the data values are needed
@param data_item: The data_item needed. Like open, close, volume etc. May be a list, in which case a list of DataFrame is returned.
@param bIncDelist: If true, delisted securities will be included.
@note: If a symbol is not found then a message is printed. All the values in the column for that stock will be NaN. Execution then
continues as usual. No errors are raised at the moment.
'''
@guilespi
guilespi / parallel-words.clj
Created November 13, 2013 23:27
Split a string into words, parallel implementation using clojure fold
(defn maybe-word
[s]
(if (= "" s) [] [s]))
(defprotocol WordState
(append-chunk [this chunk] "Append a chunk to current word state")
(append-segment [this segment] "Append a segment to current word state")
(to-word-list [this] "Returns the state as a list of words"))
@guilespi
guilespi / dec2rom.clj
Last active December 31, 2015 19:09
decimal to roman
(def conv-table (sorted-map 1 :I
4 :IV
5 :V
9 :IX
10 :X
40 :XL
50 :L
90 :XC
100 :C
400 :CD
@guilespi
guilespi / mutagenesis.R
Created October 28, 2013 16:40
charting
library(ggplot2)
library(reshape2)
results <- read.csv("/Users/guilespi/Downloads/practico 3 - datos - mutagenesis.csv")
results$NroGrupo <- paste(results$Grupo, ".", results$Subgrupo)
timedMeasures <- melt(results, id.vars = c("Grupo", "Subgrupo", "NroGrupo", "Hongo", "Distancia", "Potencia"), value.name="Colonias", variable.name="Tiempo")
ggplot(timedMeasures, aes(x = Tiempo, y = Colonias, colour = NroGrupo)) + geom_line(aes(group = NroGrupo))
results$sobrevida <- (results$t5 / results$t0) * 100
ggplot(data=results, aes(x=NroGrupo, y=sobrevida, fill=Potencia)) +
@guilespi
guilespi / analisis1.clj
Created July 30, 2013 00:13
el porcentaje de egresados es un bolaso si no contás cuantas veces la gente rinde una materia, estamos hablando de % de aprobación no de egreso
(defn analisis1
[students approval-rate]
(let [total (count students)
expected-approvals (* total approval-rate)]
(loop [examined students iterations 0]
(let [remaining (- total (count examined))]
(if (< remaining expected-approvals)
(let [approved (* (count examined) 0.1)]
(recur (drop (int approved) examined) (inc iterations)))
<?php
//Main script settings
$CALL_ERROR_MSG = "Sorry, but I could not connect your call. Please try again later";
$ALT_CALLER_ID = "";
if (substr($CALLER_ID, 0, 3)=="011") {
$CALLER_ID = "00" . substr($CALLER_ID, 3);
}
@guilespi
guilespi / census2011.r
Created May 18, 2013 18:15
Census data 2011
> viviendas <- read.table("Viviendas.dat", header=T, sep="\t")
> head(viviendas)
DPTO LOC SECC SEGM VIVID VIVVO01 VIVVO03 VIVVO04 VIVDV01 VIVDV02 VIVDV03 VIVDV05 VIVDV06 VIVDV07 VIVHV01 VIVHV01_1 CATEVIV
1 1 20 1 1 1 9 3 2 0 0 0 0 0 0 0 0 0
2 1 20 1 1 2 1 4 0 0 0 0 0 0 0 0 0 0
3 1 20 1 1 3 3 1 0 1 1 1 1 1 1 1 1 1
4 1 20 1 1 4 3 1 0 1 1 1 1 1 1 1 1 1
5 1 20 1 1 5 3 1 0 1 1 1 1 1 1 1 1 1
6 1 20 1 1 6 1 6 0 0 0 0 0 0 0 0 0 0