Skip to content

Instantly share code, notes, and snippets.

View FelipeCortez's full-sized avatar
💭
🐴

Felipe FelipeCortez

💭
🐴
View GitHub Profile
(comment
(import '[java.time Duration])
@(def subs (slurp "/Users/felipecortez/suboverride.ttml"))
(spit "/Users/felipecortez/suboverride-good.ttml"
(clojure.string/replace subs #"\d\d:\d\d:\d\d\.\d\d\d" shifted)))
(defn shifted [cue-timing]
(let [[h m s ms] (map #(Integer/parseInt % 10) (str/split cue-timing #"[:.]"))
@FelipeCortez
FelipeCortez / gist:31b4da7f80d1edeff88512e42dbbf7ca
Created March 2, 2021 11:47
Inserting special characters with rofi
/usr/bin/env bash
line=$(echo "· interpunct|◊ diamond" | rofi -sep '|' -dmenu -p)
exit_code=$?
printf $line | bb -i '(println (str (ffirst *input*)))' | iconv -f UTF8 -t UTF16BE | xvkbd -utf16 -file -
# for debugging LE/BE iconv
# od -A x -t x1z -v
# babashka definitely is overkill
{ stdenv, unzip, pkgs, autoPatchelfHook, zlib}:
pkgs.stdenv.mkDerivation {
name = "babashkabin";
src = pkgs.fetchurl {
url = "https://github.com/borkdude/babashka/releases/download/v0.2.4/babashka-0.2.4-linux-amd64.zip";
sha256 = "d56ff45b80226685bf2f804718780a82d30cffa4bda701a28cb170de176bc1fa";
};
nativeBuildInputs = [ unzip autoPatchelfHook ];
(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
bindsym $mod+d exec "rofi -matching fuzzy -show run -modi \\"run,window\\""
@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
\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
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
@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])
@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