Skip to content

Instantly share code, notes, and snippets.

@ivoscc
ivoscc / brainfuck.py
Last active August 22, 2016 13:33
Brainfuck Interpreter
# -*- coding: utf-8 -*-
import os
import sys
import time
IP = 0 # Instruction pointer
DP = 0 # Data pointer
DATA = [0] * 20
OUTPUT = []
var http = require("http");
var server = http.createServer(function (req, res) {
// needs to be a big enough file for the download not to finish inmediately
var url = "http://lolpics.se/pics/1871.jpg";
res.writeHead(200, {"Content-Type": "application/octet- stream",
"Content-Disposition": "attachment; filename='big.jpg'"});
var file_request = http.request(url, function(file_response) {
file_response.pipe(res);
file_response.on("data", function(data) {
(defun persp-cycle ()
"Cycle throught the available perspectives."
(interactive)
(let ((next-pos (1+ (persp-curr-position)))
(list-size (length (persp-all-names))))
(cond ((eq 1 list-size) (persp-switch nil))
((>= next-pos list-size) (persp-switch (nth 0 (persp-all-names))))
(t (persp-next)))))
@ivoscc
ivoscc / avr-gcc mega2560 Makefile
Created December 16, 2013 06:02
Makefile for building pure C programs on a arduino mega 2560 with avrdude and avr-gcc. Strongly based on the one found on: http://www.1010.co.uk/org/avr_resources.html
NAME := main
HEX := $(NAME).hex
OUT := $(NAME).out
MAP := $(NAME).map
SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
MCU := atmega2560
MCU_AVRDUDE := m2560
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'pathname'
VAGRANTFILE_API_VERSION = "2"
MEMSIZE = "1024"
NUMCPUS = "2"
CURRENT_DIR = Pathname.new(File.expand_path(File.dirname(__FILE__)))
#!/bin/bash
# Version info from elasticsearch:9200
#{
# "ok" : true,
# "status" : 200,
# "name" : "Tiger Shark",
# "version" : {
# "number" : "0.90.2",
# "snapshot_build" : false,
package memories
import (
"math/rand"
"time"
"testing"
)
func TestSRAM(t *testing.T) {
rand.Seed(time.Now().UnixNano())
@ivoscc
ivoscc / gist:5993487
Created July 14, 2013 07:18
mini stack thingy
package memories
import (
"fmt"
"errors"
)
type SRAM struct {
size int
memory []uint8
@ivoscc
ivoscc / .zshrc
Created July 1, 2013 22:54
Git time saving
alias ga='git add'
alias gp='git push'
alias gl='git log --graph --all --pretty="format:%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset"'
alias gs='git status'
alias gd='git diff --color-words'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
#/etc/network.d/eth0
CONNECTION='ethernet'
DESCRIPTION='VPS eth0 connection'
INTERFACE='eth0'
IP='static'
ADDR='X.X.X.X'
GATEWAY='X.X.X.X'
DNS=('8.8.8.8' '8.8.4.4')