Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ismael Venegas Castelló SalchiPapa

🎯
Focusing
View GitHub Profile
View tets.jl
function test()
print("This is a test!")
end
@SalchiPapa
SalchiPapa / str_cat.jl
Created Feb 3, 2014
String concatenation demo in Julia with the *= operator.
View str_cat.jl
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
ismaelvc@toybox ~> julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" to list help topics
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+1316 (2014-01-30 05:22 UTC)
View ejemplo_if.c
#include <stdio.h>
#define MAX 5
int main(void)
{
int arreglo[] = {1, 2, 3, 4, 5};
int i;
for(i=0; i < MAX; i++) {
int numero = arreglo[i];
View constante_e.py
ismaelvc@toybox ~> python2
Python 2.7.6 (default, Feb 15 2014, 23:01:55)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.e
2.718281828459045
ismaelvc@toybox ~> python
Python 3.3.4 (default, Feb 11 2014, 16:14:21)
[GCC 4.8.2 20140206 (prerelease)] on linux
@SalchiPapa
SalchiPapa / guess_number.jl
Last active Aug 29, 2015
Example of 1 vs 0 based indexing.
View guess_number.jl
#!/usr/bin/env julia
range = 1:100
big = range[end]
small = range[1]
function guess()
(small + big) >> 1
end
@SalchiPapa
SalchiPapa / valid_base_3.py
Last active Aug 29, 2015
Checks wheter a string is a valid base 3 number representation.
View valid_base_3.py
In [1]: valid_base_3_digits = ['0', '1', '2']
In [2]: for digit in '012':
...: if digit not in valid_base_3_digits:
...: print("That won't work!")
...: else:
...: print("Seems right!")
...:
Seems right!
Seems right!
@SalchiPapa
SalchiPapa / caras_cubo.jl
Last active Aug 29, 2015
caras de un cubo?
View caras_cubo.jl
ismaelvc@toybox ~> julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" to list help topics
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+1672 (2014-02-22 04:00 UTC)
_/ |\__'_|_|_|\__'_| | Commit b2fea25* (0 days old master)
|__/ | i686-pc-linux-gnu
@SalchiPapa
SalchiPapa / sum_even_factorials.py
Last active Aug 29, 2015
Sum even factorials.
View sum_even_factorials.py
#!/usr/bin/env python3
def factorial(n):
"""
>>> factorial(20)
2432902008176640000
"""
if n < 2:
return 1
@SalchiPapa
SalchiPapa / Identidad_Trigonometrica.ipynb
Last active Aug 29, 2015
Identidad trigonometrica en Julia.
View Identidad_Trigonometrica.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View caras_rubik.py
[[[ 1, 2, 3],
[ 4, 5, 6],
[ 7, 8, 9]],
[[10, 11, 12],
[13, 14, 15],
[16, 17, 18]],
[[19, 20, 21],
[22, 23, 24],
You can’t perform that action at this time.