Skip to content

Instantly share code, notes, and snippets.

View FelipeCortez's full-sized avatar
💭
🐴

Felipe FelipeCortez

💭
🐴
View GitHub Profile
@FelipeCortez
FelipeCortez / listings.tex
Last active March 14, 2024 16:35
LaTeX pretty listings
\usepackage{listings}
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
@FelipeCortez
FelipeCortez / .vimrc
Last active August 29, 2015 14:00
Simplified .vimrc
syntax on
filetype plugin indent on
set encoding=utf-8
set showcmd
set relativenumber
set noswapfile
set undofile
set undodir=~/.vim/undo
set undolevels=1000
@FelipeCortez
FelipeCortez / lab2.sce
Created March 8, 2017 00:41
Mary had a little lamb
rate = 8000
freqs = [494 440 392 440 494 494 494]
x = 0:1/rate:3.5
y = zeros(x)
range = 1:4001
for i = 1:length(freqs)
y(range) = exp(-10 * x(range) + 5 * (i - 1)) .* sin(2 * %pi * freqs(i) * x(range))
range = range + 4000
end
@FelipeCortez
FelipeCortez / lab3.sce
Last active March 15, 2017 09:28
FFT and reconstruction
function [magnitude, phase] = fourierSeries(x)
// FOURIERSERIES - Return the magnitude and phase of each
// sinusoidal component in the Fourier series expansion for
// the argument, which is interpreted as one cycle of a
// periodic signal. The argument is assumed to have an
// even number p of samples. The first returned value is an
// array containing the amplitudes of the sinusoidal
// components in the Fourier series expansion, with
// frequencies 0, 1/p, 2/p, ... 1/2. The second returned
// value is an array of phases for the sinusoidal
@FelipeCortez
FelipeCortez / lab4.sce
Created March 15, 2017 11:49
Filtering
function [] = pre1()
clf()
x = [1, zeros(1,99)]
y = filter([1], [1, 0.95], x)
plot2d3(y)
endfunction
function [] = pre2()
clf()
h = iir(10, 'lp', 'butt', 0.125, [0 0])
import logging
import sys
import time
import rtmidi
import liblo
from rtmidi.midiutil import open_midiinput, open_midioutput
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QColor, QFont
from PyQt5.QtCore import Qt, QPointF, QRectF, QTimer, pyqtSlot, pyqtSignal
\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[brazilian]{babel} % Hifenização e dicionário
\usepackage[left=3.00cm, right=2.00cm, top=3.00cm, bottom=2.00cm]{geometry}
\usepackage{enumitem} % Para itemsep etc
\usepackage{longtable} % Dependência do longtabu
\usepackage{tabu} % Para melhor criação de tabelas
\usepackage{listings} % Para códigos
\usepackage{lstautogobble} % Códigos indentados corretamente
\usepackage{color} % Para coloração de códigos
@FelipeCortez
FelipeCortez / replace.el
Created July 20, 2018 13:47
href to url_for (spacemacs / regexp)
:%s/'<,'>s/href="\([^"]*\)"/href="{{ url_for('static', filename='\1') }}"/g
copy from minibuffer with C-x h + M-w (https://emacs.stackexchange.com/a/37181)
paste with C-y
bindsym $mod+d exec "rofi -matching fuzzy -show run -modi \\"run,window\\""
(require '[clojure.java.io :as io])
(defn visit-print
"println approach"
[path level]
(when (some #(clojure.string/includes? % ".md") (file-seq (io/file path)))
(println (str (apply str (repeat level " ")) "- " (.getName (io/file path))))
(doseq [path (.listFiles (io/file path))] (visit-print path (inc level)))))
(defn visit-print