Skip to content

Instantly share code, notes, and snippets.

View matiskay's full-sized avatar

Edgar Marca matiskay

View GitHub Profile
@matiskay
matiskay / flash.sh
Created May 12, 2012 22:43
Flash Scaffold
#! /bin/bash
# PRECONDITIONS
# virtualenv
# virtualenv -> http://flask.pocoo.org/docs/installation/#virtualenv
makeapp () {
{
@matiskay
matiskay / gitio
Created June 14, 2012 12:57 — forked from defunkt/gitio
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@matiskay
matiskay / config.sh
Created June 30, 2012 15:27
My config file
# \u Username
# \w Current directory
# \d Date
# \D{fmt} Date as sprintf
# \h Subdomain
# \H Full hostname
# Get more colors from archlinux wiki color bash prompt
function proml {
local BLUE="\[\033[0;34m\]"
@matiskay
matiskay / gist:3181894
Created July 26, 2012 12:56
Clean Install – Mountain Lion OS X 10.8 DP3
@matiskay
matiskay / 1.f90
Created September 1, 2012 03:53
Fortran Coding
! Write a program that evals the following operations and show then in
! the screen
a = 8 / 2
b = 6 / 10
c = (6 + 8) / 5
d = 4 * 5 / 3 * 2
e = (4 * 5) / (3 / 2)
f = (4 * (5 / 3) / 2)
write (*,*) '8 / 2 =>' , a
@matiskay
matiskay / README
Created September 3, 2012 14:16
Trigger a Drupal Context programatically
It's not immediately clear from the context_set() function how to trigger a context to be "active" using code. Do it like this:
Source: http://snipplr.com/view/58723/trigger-a-drupal-context-programatically/
@matiskay
matiskay / 1.f90
Created September 24, 2012 02:10
Fotran Problems set 2
! gfortran 1.f90
program main
implicit none
integer :: a
integer :: n
print *, 'Insert the value of a: '
read (*, *) a
n = 7
if (mod(a, n) == 0) then
@matiskay
matiskay / Makefile
Created September 25, 2012 03:27
Fotran Problem set 3
FORTRAN_COMPILER=gfortran
all:
$(FORTRAN_COMPILER) problem-set-3.f90 -o problem-set-3
clean:
rm problem-set-3
@matiskay
matiskay / image_width_height.py
Created November 18, 2012 03:18
Get width and height from an image file
#! /usr/bin/python
from PIL import Image
import sys
if len(sys.argv) >= 2:
image_file = sys.argv[1]
try:
img = Image.open(image_file)
width, height = img.size
@matiskay
matiskay / min.py
Created December 3, 2012 04:14
Get the minimum integer value from an operation combining a set of integer.
numbers = [5, 7, 8, 6, 4]
values = []
#5 6 7 4 8
#6 5 7 4 8
def is_integer(n, p, q, r, s):
if ((n + p - q) * r) % s == 0:
return True