Skip to content

Instantly share code, notes, and snippets.

View rberaldo's full-sized avatar

Rafael Beraldo rberaldo

View GitHub Profile
@rberaldo
rberaldo / shellf.py
Created September 10, 2012 06:45
That's my first exercise on I/O!
def createBook(title,author,year):
outFile = open('database.txt', 'wt')
outFile.write("[book]\n")
outFile.write("title: " + title + "\n")
outFile.write("author: " + author + "\n")
outFile.write("year: " + year + "\n")
outFile.close()
print("Welcome to Shellf!")
print("Answer the questions to add your book do the database.")
@rberaldo
rberaldo / shellf.py
Created September 11, 2012 03:38
Ensaio para um gerenciador de coleções
#!/usr/bin/python
import os # To check if database.txt exists
import argparse # Happily handles arguments and options
# My lovely arguments (working on them)
parser = argparse.ArgumentParser()
parser.add_argument("-a", "--author", help="the author of the book", action="store", required=True)
parser.add_argument("-t", "--title", help="the title of the book", action="store", required=True)
parser.add_argument("-y", "--year", help="the year the book was published", action="store", required=True)
parser.add_argument("-p", "--publisher", help="the company that published the book", action="store", required=True)
#!/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}')
@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
@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\
// 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
/**
* caesar.c
*
* Rafael Beraldo
* rberaldo@cabaladada.org
*
* Encrypts text with the Caesar cipher
*/
#include <stdio.h>
/**
* vigenere.c
*
* Rafael Beraldo
* rberaldo@cabaladada.org
*
* Encrypts text with the Vigenère cipher
*/
#include <stdio.h>
@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
\documentclass{article}
\usepackage{enumerate}
\begin{document}
\newcounter{meu-contador} % criamos um novo contador
\begin{enumerate}
\item um
\item dois
\item três