Skip to content

Instantly share code, notes, and snippets.

View rberaldo's full-sized avatar

Rafael Beraldo rberaldo

View GitHub Profile
@rberaldo
rberaldo / ledger-fetch-commodity-prices.el
Created September 14, 2022 03:39
Automatically fetch ledger entries of commodity prices.
;;
;; ledger helper functions
(defun my/ledger-copy-down-commodity-price ()
"Adds a new, updated ledger commodity price entry based on the
current line, which should follow the structure \"P DATE TIME
COMMODITY PRICE CURRENCY\". Automatically updates date, time and
fetches current prices."
(interactive)
(let (line commodity price)
;; Read current line and split it.
@rberaldo
rberaldo / obsidian-to-org.py
Last active September 30, 2023 23:24
Obsidian to org-roam migration kit – a completely half-baked attempt at moving from Obsidian to org-roam which nevertheless works (for me).
#!/usr/bin/python
import sys,re,os
if not os.path.isdir("out/"):
os.mkdir("out/")
md_file = sys.argv[1]
org_file = md_file[:-3] + ".org"
\documentclass{article}
\usepackage{enumerate}
\begin{document}
\newcounter{meu-contador} % criamos um novo contador
\begin{enumerate}
\item um
\item dois
\item três
@rberaldo
rberaldo / .Xresources
Last active January 19, 2019 11:41
My config files for Vaporwave Paraiso theme.
! ------------------------------------------------------------------------------
! ROFI Color theme
! ------------------------------------------------------------------------------
rofi.color-enabled: true
rofi.color-window: #2f1e2e, #a39e9b, #815ba4
rofi.color-normal: #2f1e2e, #a39e9b, #41323f, #e96ba8, #ffffff
rofi.color-active: #2f1e2e, #a39e9b, #41323f, #e96ba8, #66c6ff
rofi.color-urgent: #2f1e2e, #a39e9b, #41323f, #e96ba8, #890661
/**
* vigenere.c
*
* Rafael Beraldo
* rberaldo@cabaladada.org
*
* Encrypts text with the Vigenère cipher
*/
#include <stdio.h>
/**
* caesar.c
*
* Rafael Beraldo
* rberaldo@cabaladada.org
*
* Encrypts text with the Caesar cipher
*/
#include <stdio.h>
// Outputs the uppercase initials of a name
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#define FIRSTLETTER 0
int main(void)
{
// Get user input
@rberaldo
rberaldo / ip.sh
Last active December 15, 2015 10:39
A small script I thought about writing in a dream.
#!/bin/bash
IP=$(curl canihazip.com/s/ 2> /dev/null)
IP_FILE="/tmp/ip.txt "
if [ ! -f $IP_FILE ]
then
# If $IP_FILE doesn't exist, create one and mail me.
echo $IP > $IP_FILE
echo -e "A new /tmp/ip.txt file was created @ cookie.\n\
@rberaldo
rberaldo / primes.py
Created November 16, 2012 02:52
Getting prime numbers from 1000 to 0
def is_prime(n):
count = 2
if n < count:
return False
else:
while count < n:
if n % count == 0:
return False
else:
count += 1
#!/bin/bash
TESTA=$(grep 'EQ_HAS_HYPO' $1)
if [ '$TESTA' == 'EQ_HAS_HYPO' ] ; then
ALIGN='EQ_HAS_HYPO'
else
ALIGN='EQ_SYNONYM'
fi
CHAVE=$(grep 'Chave' $1 | awk -F" " '{print $2}')