Skip to content

Instantly share code, notes, and snippets.

@ixxra
ixxra / test-dcb.py
Last active December 18, 2015 05:38
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
a = imread('cmb_greyscale.png')
aa = mean(a, 2)
from math import ceil
@ixxra
ixxra / sage-pascal-matrix.py
Created June 17, 2013 19:41
Fractal from pascal triangle writen in python (sage mathematics)
def pascal_matrix(size=500, zp=3):
'''
Creates a matrix of size x size, whose entries are numbers in zp, such that
entry M_{ij} is obtained recursively as in pascal triangle. Each diagonal on
the matrix corresponds to a row in Pascal's triangle.
'''
M = ones_matrix(size,size)
for i in range(1, size):
for j in range(1, size):
M[i, j] = M[i - 1, j] + M[i, j - 1]
@ixxra
ixxra / cantor-dust-sage.py
Created June 20, 2013 15:52
sagenb.org has made worksheets private, this is part of my notebook on cantor dust
#This goes in one cell alone
class Carpet:
'''
This class contains the generator for Carpet fractals generated by regular polygons.
It generates the carpet vertices recursively, which is not very efficient, but it
goes along with the mathematical definition.
'''
def __init__(self, x, y, sides, r, contraction):
'''
@ixxra
ixxra / school-wpa
Created October 10, 2013 15:17
Simple configuration for netctl to connect to a WPA2 network (@myschool)
Description='A wireless connection using a custom network block configuration'
Interface=wlp3s0
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
'ssid="university-ssid"'
'scan_ssid=1'
'key_mgmt=WPA-EAP'
'identity="username"'
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
import pylab
import scipy.interpolate
#Lo siguiente es para separar la lista de puntos en los de coordenadas x y los de coordenadas y
'''
A=[[950,1090],[850,1290],[810,1450], [758,1705], [320, 2340] , [860, 1950] , [750,2875] , [1090,2090] , [1148,3020] , [1360, 2110] , [1650,2805] , [1580,1910] , [1700,1710] , [2040,2050] , [2000,1790] , [1840,1510] , [1740,1350] , [1610,1150]]
@ixxra
ixxra / gist:7643793
Created November 25, 2013 16:08
Si enlistamos todos los numeros naturales menores que 10 y que son multiplos de 3 o 5, estos son 3, 5, 6 y 9. La suma de estos numeros es 23. Encuentra la suma de todos los multiplos de 3 o 5 que son menores que 1000.
#Initialization
sum = 0
mult = 3
#Sumamos multiplos de 3 que no sean multiplos de 5
while mult < 1000:
if mult % 5 != 0:
if mult %3 != 0:
sum = sum + mult
@ixxra
ixxra / area problema de la elipse
Created November 28, 2013 19:44
This is used to calculate an elliptical sector area for a numerical analysis problem...
from math import sqrt, cos
MAX = 1.52097701e8 #km
MIN = 1.47098074e8 #km
A = (MAX + MIN)/2.
C = (MAX - MIN)/2.;
E = C/A
B = sqrt(A**2-C**2)
#theta = var('theta')
def R(theta): return A*(1-E**2)/(1 - E*cos(theta))
@ixxra
ixxra / reloj.py
Last active April 4, 2023 16:48
Simple binary/hexadecimal clock written in python for my "introduction to numerical analysis class".
'''
Simple binary/hexadecimal clock written in python.
This programm is an example for my "introduction to numerical analysis class" at Universidad Autonoma de Yucatan.
Feel free to copy/modify at your convenience.
'''
import time
@ixxra
ixxra / rip.sh
Created February 17, 2014 03:33
rip.sh - Rip a cd into flac files. It uses cd-info and gstreamer 1.0
#!/bin/bash
#
#rip.sh
#
#Rip a cd into flac files.
#
#It uses cd-info and gstreamer 1.0
#
@ixxra
ixxra / info2meta
Created February 17, 2014 03:39
info2meta - Reads metadata information as downloaded by cd-info and writes it to flac files. See https://gist.github.com/ixxra/9044268 too
#!/usr/bin/env ruby
#
#
#info2meta
#
#Reads metadata information as downloaded by cd-info and writes it to flac files.
#I use this script together with https://gist.github.com/ixxra/9044268 to rip my
#cds into flac format.
#