Skip to content

Instantly share code, notes, and snippets.

@ivoscc
ivoscc / gist:5030284
Created February 25, 2013 14:49
uwsgi.service para gestionar con systemd. Copiar a /usr/lib/systemd/system/uwsgi.service Habilitar con systemctl enable uwsgi.service
[Unit]
Description=uWSGI in Emperor mode
After=syslog.target
[Service]
ExecStart = /usr/bin/uwsgi --ini /etc/uwsgi/emperor.ini
KillSignal=SIGINT
ExecReload=/bin/kill -HUP $MAINPID
Restart = always
Type = notify
@ivoscc
ivoscc / gist:5365488
Created April 11, 2013 17:41
Check if 2 strings are cycles
rotate :: [Char] -> [Char] -> Int -> Bool
rotate _ _ 0 = False
rotate s1 s2 len = if s1' == s2 then True else rotate s1' s2 (len-1)
where s1' = tail s1 ++ [head s1]
cyclep :: [Char] -> [Char] -> Bool
cyclep str1 str2 = rotate str1 str2 (length str1)
#/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')
@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'
@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
package memories
import (
"math/rand"
"time"
"testing"
)
func TestSRAM(t *testing.T) {
rand.Seed(time.Now().UnixNano())
#!/bin/bash
# Version info from elasticsearch:9200
#{
# "ok" : true,
# "status" : 200,
# "name" : "Tiger Shark",
# "version" : {
# "number" : "0.90.2",
# "snapshot_build" : false,
# -*- 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__)))
@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
(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)))))