Skip to content

Instantly share code, notes, and snippets.

View gciruelos's full-sized avatar

Gonzalo Ciruelos gciruelos

View GitHub Profile
@gciruelos
gciruelos / gist:e378061eae84ffc47026e1aa286d2ad9
Created September 20, 2017 03:35
Instalar gcc 5 en ubuntu
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
# robado de: https://gist.github.com/beci/2a2091f282042ed20cda por si lo borra
ifndef $(CC)
CC = gcc
endif
WARNINGS = -Wall -Wextra -Werror -Wshadow -Wstrict-prototypes -Wpointer-arith \
-Wcast-qual
OPT_FLAGS = -O2 -flto -ffast-math
CFLAGS = $(WARNINGS) -Werror -std=c99 -pedantic
LFLAGS = -lm
TEST_DIR = test/
SRC_DIR = src/
import itertools
import pprint
pp = pprint.PrettyPrinter(depth=6)
def creciente_estricta(l):
return all(x<y for x, y in zip(l, l[1:]))
def generar_matrices(p):
lista = itertools.permutations(range(2*p), 2*p)
#!/usr/bin/env python3
asm = {
'AAA': {'name': 'AAA','url': 'http://www.felixcloutier.com/x86/AAA.html','description': 'ASCII Adjust After Addition'},
'AAD': {'name': 'AAD','url': 'http://www.felixcloutier.com/x86/AAD.html','description': 'ASCII Adjust AX Before Division'},
'AAM': {'name': 'AAM','url': 'http://www.felixcloutier.com/x86/AAM.html','description': 'ASCII Adjust AX After Multiply'},
'AAS': {'name': 'AAS','url': 'http://www.felixcloutier.com/x86/AAS.html','description': 'ASCII Adjust AL After Subtraction'},
'ADC': {'name': 'ADC','url': 'http://www.felixcloutier.com/x86/ADC.html','description': 'Add with Carry'},
'ADD': {'name': 'ADD','url': 'http://www.felixcloutier.com/x86/ADD.html','description': 'Add'},
'ADDPD': {'name': 'ADDPD','url': 'http://www.felixcloutier.com/x86/ADDPD.html','description': 'Add Packed Double-Precision Floating-Point Values'},
@gciruelos
gciruelos / roundest.py
Last active February 17, 2020 01:18
What is the roundest country?
'''
Post: http://gciruelos.com/what-is-the-roundest-country.html
Compute and create table of the roundness of all the countries.
Needs file ne_10m_admin_0_sovereignty.
'''
import base64
import io
import math
import operator
.text
.file "fact.c"
.section .rodata.cst16,"aM",@progbits,16
.align 16
.LCPI0_0:
.long 1 # 0x1
.long 1 # 0x1
.long 1 # 0x1
.long 1 # 0x1
.LCPI0_1:
@gciruelos
gciruelos / .zshrc
Created December 5, 2014 21:05
.zshrc
#------------------------------------------------------------------#
# File: .zshrc ZSH resource file #
# Version: 0.1.16 #
# Author: Øyvind "Mr.Elendig" Heggstad <mrelendig@har-ikkje.net> #
#------------------------------------------------------------------#
#------------------------------
# History stuff
#------------------------------
HISTFILE=~/.histfile
@gciruelos
gciruelos / .tmux.conf
Last active August 29, 2015 14:10
.tmux.conf
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
#vewy importnat, puede freezear la terminal sin esto
set -g set-titles off
setw -g c0-change-trigger 10
setw -g c0-change-interval 250
@gciruelos
gciruelos / intuitionistic.hs
Created August 19, 2014 00:48
intuitionistic
import Data.Maybe
import System.IO.Unsafe
import Debug.Trace
data P = T | F | Var Char | Or P P | And P P | If P P
deriving Eq
instance Show P where
show T = "T"
@gciruelos
gciruelos / A.py
Last active August 29, 2015 13:59
Google Code Jam 2014 - Qualification Round
# Gonzalo Ciruelos
# Problem A
def intersection(set1, set2):
for a in set1:
if a in set2:
yield a
f = open('A-small-attempt0.in', 'r')