Skip to content

Instantly share code, notes, and snippets.

View juanpaucar's full-sized avatar
🍕
:shipit:

Juan Paucar juanpaucar

🍕
:shipit:
View GitHub Profile
dd if=/dev/zero of=/tmp/swap bs=1M count=1024 &&
mkswap /tmp/swap &&
sudo swapon /tmp/swap
@juanpaucar
juanpaucar / migration.txt
Created August 21, 2015 15:51
Example of moo migration
Description: Create table device_statuses
Created: 2014-12-18 22:03:33.713691 UTC
Depends: enable_uuid_generation create_table_devices
Apply:
CREATE TABLE device_statuses (
id serial NOT NULL,
battery_status double precision NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
device_uuid uuid NOT NULL
);
#!/bin/sh
export DBM_DATABASE="dbname=battery_server"
export DBM_DATABASE_TYPE=postgresql
export DBM_MIGRATION_STORE=migrations
moo/.cabal-sandbox/bin/moo $@
//FROM https://github.com/eliben/cs344/blob/master/HW2/student_func.cu#L291-L337
// Homework 2
// Image Blurring
//
// In this homework we are blurring an image. To do this, imagine that we have a
// square array of weight values. For each pixel in the image, imagine that we
// overlay this square array of weights on top of the image such that the center
// of the weight array is aligned with the current pixel. To compute a blurred
// Homework 1
// Color to Greyscale Conversion
//A common way to represent color images is known as RGBA - the color
//is specified by how much Red, Green, and Blue is in it.
//The 'A' stands for Alpha and is used for transparency; it will be
//ignored in this homework.
//Each channel Red, Blue, Green, and Alpha is represented by one byte.
//Since we are using one byte for each color there are 256 different
@juanpaucar
juanpaucar / gist:260b6eb9e59833813174
Last active August 29, 2015 14:20
Paralelización en Haskell

#Paralelización en Haskell

Como compilar: ghc tres.hs -o tres

Para paralelizar con el compilador: ghc tres.hs -o tres -threaded -ON donde N es el número de procesador disponibles en el sistema

El problema radica en que en Haskell las listas normales del tipo por ejemplo [Int] o matrices como [[Int]] son listas enlazadas que pueden tomar un tiempo extra para trabajar.

Haskell provee una librería para trabajar con arreglos de elementos con una alta optimización

An efficient implementation of Int-indexed arrays (both mutable and immutable), with a powerful loop optimisation framework.