Skip to content

Instantly share code, notes, and snippets.

View cmaureir's full-sized avatar
🇨🇱
¯\_(ツ)_/¯

Cristián Maureira-Fredes cmaureir

🇨🇱
¯\_(ツ)_/¯
View GitHub Profile
@cmaureir
cmaureir / zmq_empty_issue
Created February 23, 2012 23:06
ZeroMQ empty message issue
I'm trying to develop the following messaging structure
A -> B -> C
A:
-send a message to B (send)
-waits for a B answer (recv)
B:
-receive the A message (recv)
@cmaureir
cmaureir / leibniz.cu
Created April 24, 2012 14:08
CUDA Leibniz
#include <stdio.h>
#include <math.h>
#define N (32 * 1000000)
__global__ void pi_elem(float *values)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
values[i] = pow((float)-1,(float)i);
values[i] /= (2*i+1);
@cmaureir
cmaureir / dup
Created May 15, 2012 18:06
Improved «du»
#!/bin/bash
du -sk ./* | sort -n | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }'
@cmaureir
cmaureir / neural-time
Created July 30, 2012 23:06
Neural-GPU time
# Los tiempos equivalen a "1000 iteraciones" del mismo cálculo expresados en segundos.
500-500-500
GPU: 0.578916
CPU: 0.351443
1000-1000-1000
GPU: 0.698903
CPU: 0.721079
@cmaureir
cmaureir / pi.cu
Created August 9, 2012 14:06
Pi-leibniz
#include <stdio.h>
#include <iostream>
#define N 10000
__global__ void pi_elem(float *values)
{
int i = threadIdx.x + blockIdx.x * blockDim.x;
if (i < N){
values[i] = pow((float)-1,(float)i);
@cmaureir
cmaureir / pending
Last active October 9, 2015 02:58
Pending Movies
Movies
-------
* Last Stand
* Battleship
* The King of Kong
* Anchorman 2
* Here comes the boom
* Rurouni Kenshin: Shin Kyoto Hen OVA
@cmaureir
cmaureir / arch-install
Last active June 27, 2016 14:09
Arch Installation
* Partitioning
$ cfdisk
Considering:
* Primary partition 100M boot
* Primary partition 20000M /
* Primary partition -everything else- /home
* Logical partition 1024 swap (1G, Depending of the amount of RAM)
* Creating filesystem
* boot
@cmaureir
cmaureir / git-brief
Created February 26, 2013 19:14
How to Git (Brief)
## Commands
# Clone repository from GitHub
git clone git@github.com:username/repository
# Check repository status (modified files, commits, etc)
git status
# Update repository
git pull
@cmaureir
cmaureir / arch-uefi
Created March 4, 2013 17:41
Arch UEFI
Source: https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface
Create UEFI bootable USB from ISO
-----------------------------------
Note: The instructions below are specifically for Archiso/official media; Archboot preparation is identical, with this refind.conf instead of the one mentioned below (which is for Archiso) and without the filesystem label requirement.
Note: The USB can use either MBR or GPT partition table (so it is fine to use an already partitioned USB). The filesystem should be either FAT32 (recommended) or FAT16. FAT12 is designed for floppy drives and therefore not recommended for USB drives.
First create a partition table and at most one partition in the USB. Mount the ISO image from the Arch Linux download page.
ifconfig wlan0 down
airodump-ng --ivs -w NOMBRE_ARCHIVO wlan0
airodump-ng --ivs -w NOMBRE_ARCHIVO wlan0 --channel CANAL
aircrack-ng -a 1 NOMBRE_ARCHIVO.ivs
iwconfig wlan0 essid NOMBRE_RED
iwconfig wlan0 key XXXXXXXXXXXX
ifconfig wlan0 up
dhcpcd wlan0