Skip to content

Instantly share code, notes, and snippets.

View alcides's full-sized avatar

Alcides Fonseca alcides

View GitHub Profile
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.util.Random;
public class Example {
@alcides
alcides / automarkdown.sh
Last active February 7, 2018 21:05
Automatically refreshes top-most Safari tab
# Dependencies:
# > brew install watch markdown
# Usage:
# > bash automarkdown.sh Readme.md
MDFILE=/tmp/preview.html
touch $MDFILE && open $MDFILE
watch "markdown $@ > $MDFILE && osascript -e 'if application \"Safari\" is running then
@alcides
alcides / hist.py
Created January 12, 2017 20:23
Histogram in Python using Matplotlib
a = """
6,66
5,88
2,33
5,85
5,68
6,15
5,98
6,96
4,33
# table$newCol = convertDots(table$oldCol)
convertDots <- function(x) {
x[x == "."] <- NA;
y <- as.numeric(x);
y[is.na(y)] <- 0;
y
}
def check(arr):
return arr[0] + 13 * arr[1] / float(arr[2]) + arr[3] + 12 * arr[4] - arr[5] - 11 + arr[6] * arr[7] / float(arr[8]) - 10 == 66
import random
arr = range(1,10)
while not check(arr):
random.shuffle(arr)
import os, random, datetime
from PIL import Image, ImageDraw, ImageFont
from AppKit import NSScreen
now = datetime.datetime.now()
then = datetime.datetime(2015,03,19)
days = abs((then - now).days)
fname = "countdown%d.png" % random.randint(0,2)
@alcides
alcides / index.html
Created February 22, 2015 22:11
React.js NoteTaking app with Markdown preview and DropBox storage.
<style>
#username {
float: right;
margin-right: 100px;
}
#files {
clear: right;
width: 20%;
float: left;
# git clone https://github.com/insieme/insieme.git
# Build
sudo apt-get install pkg-config
sudo apt-get install gcc-multilib
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
# Documentation
sudo apt-get install texlive
%IntArray = type { i32, i32* }
@a = global %IntArray { i32 0, i32* null}
define i32 @main() {
%size = add i32 0, 3
%arr = alloca i32, i32 %size
%arr_ins = insertvalue %IntArray undef, i32 %size, 0
%arr_ins2 = insertvalue %IntArray %arr_ins, i32* %arr, 1
curl http://www.marioprincipe.com/oldsite/media/portfolio/portfolio/makingof/m12_2.flv -o m12_2.flv