Skip to content

Instantly share code, notes, and snippets.

View ataias's full-sized avatar

Ataias Pereira Reis ataias

View GitHub Profile
@ataias
ataias / pgraphics.sty
Last active August 29, 2015 14:14
Staggered grid with Tikz
\ProvidesPackage{pgraphics}
\newcommand{\domainOne}[0]{
\begin{center}
\tikzstyle{help lines}+=[dashed]%
\begin{tikzpicture}
%axes
\draw[->] (0,5) -- (xyz cs:y=6);
\draw (0,6.3) node {$y(j)$};
\draw[->] (5,0) -- (xyz cs:x=6);
@ataias
ataias / poisson.jl
Last active August 29, 2015 14:15
Module written in Julia to solve Poisson equation with Neumann conditions in a square of side 1. Includes a test problem and its solution for comparison. A staggered grid is used.
module Poisson
#This is used to solve the system Ax = b in step 2
export poissonNeumannSparseSolver, getANeumannSparse, testPoissonNeumannSparse
function getANeumannSparse(n)
spn = (n-2)*(n-2) #sparse n
#Definir matriz A
A = 4*speye(spn, spn)
k=0
@ataias
ataias / NSTimer+Closure.swift
Created February 10, 2016 15:23 — forked from natecook1000/NSTimer+Closure.swift
Scheduled NSTimer with a Swift closure
extension NSTimer {
/**
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
*/
@ataias
ataias / config.json
Created February 22, 2016 12:11 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@ataias
ataias / centos-install-syntax-highlighting-in-less.sh
Created March 6, 2016 18:52 — forked from textarcana/centos-install-syntax-highlighting-in-less.sh
How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm
@ataias
ataias / 1036.cpp
Last active March 13, 2016 16:47
Bhaskara formula
#include <cstdio>
#include <cmath>
bool is_nan(double x) { return x != x; }
using namespace std;
int main() {
double A, B, C;
scanf("%lf", &A);
@ataias
ataias / multiply.py
Created June 18, 2016 16:37
multiply
import numpy
import time
A = numpy.random.rand(6,6)
B = numpy.random.rand(6,6)
start = time.clock()
D = numpy.random.rand(6,6)
for i in range(0,10):
C = A*B
D = D + C
@ataias
ataias / ramp.py
Created June 25, 2016 16:06
Create ramp input
import numpy
import matplotlib.pyplot as plt
n = 400
Ts = 0.1
t = numpy.linspace(0,n,n+1)*Ts
out_max = 0.3
y_ref = numpy.ones(n+1)*out_max
zero_time = 2.0
start = int(zero_time/Ts)
@ataias
ataias / conversion-aliases.zsh
Created April 10, 2020 20:43
Aliases to help converting files
#!/usr/bin/env zsh
# You need to have pandoc and ffmpeg installed in your system
markdown2org () {
fullFilename=$1
filename="${fullFilename%.*}"
pandoc -f markdown -t org -o "$filename".org "$fullFilename"
}
@ataias
ataias / .zshrc
Last active April 10, 2020 21:42
Basic Zsh Configuration (oh-my-zsh base + goodies)
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/vagrant/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes