pgm_compress.cpp
:
- Compresses PGM image files to an n-bit new PGM.
pgm_histogram.cpp
:
- Prints histogram of color usage of a set of grayscale PGM images files.
rcompress.sh
:
- Recursively find each PGM file in a given directory.
- Creates an n-bit compressed PGM of each found PGM file.
- Constructs a histogram out of all such PGM n-bit files.
- Prints histogram to the
stdin
.
trim.sh
:
- Trims an image with 10% fuzzy rate.
jpg2pgm.sh
:
- Resizes all files to a given (x, y) size.
- Searches for files in directories one level down.
- Ignores aspect ratio.
count.sh
:
- Counts number of files in directories one level down.
- Prints each count, mean, max and min.
coin.sh
:
- For each directory inside pwd, toss a coin for each PGM file in it.
- If heads, put it in a folder named
train
inside the directory
being scanned.
- If tails, put it in
test
.
- Number of files is limited by
ntest
and ntrain
.
word_count.cpp
:
- Takes a
.voc
file and counts word occurences (frequencies and
percentage).
prune_words.cpp
:
- Takes a
.voc
file and rewrites it as a new vocabulary containing
only the k most frequent words.
- Optionally deletes words that do not meet the criterion.
longest_word.sh
:
- Searches for the longest word in a file.
rand_sq_gen.cpp
:
- Generates a
.pgm
file containing an NxN
(where N
is a
defined macro) square with n
black squares in random positions.
sq_gen.cpp
:
- Let
N
be the size of a square. sq_gen.cpp
generates N-1
distinct instances of an NxN
square with n
random black squares in
random distinct positions.
has_duplicate.sh
:
- Given a set of files F, let i and j in F be distinct files.
has_duplicate.sh
returns whether there exists i and j such that
the contents of i are equal to those of j.
cat_sq_gen.sh
:
- For every possible n black squares configurations in a square of
NxN
dimension, create a category for each n and output N^2
configurations into their respective categories.
pgm2data.sh
:
- Generates k random PGM images given a width, height and maximum pixel
value.
- Debug mode generates individual PGM files for visualization.
- Compiles the k images into a
.data
file as specified in
https://github.com/RenatoGeh/gospn.
unique_id.go
:
- Tests a one-to-one and onto function for subrectangles in a
rectangle.
split_audio.sh
:
- Takes an audio or video
f
and splits it into pieces.
- Every timestamp given as argument splits
f
from the previous
timestamp to the next timestamp.
- Great for splitting a single file album audio into multiple singles!
extract_ty.sh
:
- Takes a YouTube URL, downloads the video, extracts the audio (
.mp3
)
and splits it into different sections based on timestamps.
- Uses
split_audio.sh
to split it by timestamps.
diff_cmp.sh
:
- Takes a directory and an expression. Finds all same name files from
current directory and given directory. For each of these files, use
NeoVim's diff tool.
- Useful for manually applying patches from different branches of the
same repository.
draw_scope.sh
:
- Draws the assigned pixels in a
w x h
image.
pgauss.go
:
- Returns the probability of a value in a gaussian distribution with
mean and standard deviation given.
- Returns up to
p
digits of precision.
- Requires
GoNum
.
argrun.sh
:
- Takes a file
f
and command c
.
- For each line
l
in f
, run c
with l
as arguments.
prepend.sh
:
- Prepends contents of first file to all remaining files.
extract_credits.sh
:
- Extracts credit information from University of São Paulo's (USP)
course webpage.
- Takes a list of courses and outputs the number of theory and practical
credits, aswell as total credits for each type of credit.
- Requires
lynx
.
spot.sh
:
- Prints sidescrolling Spotify information.
- Requires
playerctl
and the Spotify App.
- Great for i3status bar.
- Prints Title, Artist and Album.
- Prompt cycles sideways every second, avoiding long titles to be
hidden by other i3status components.
- Skips ads every even second if ad is being played.
draw_region.sh
:
- Draws a region of a rectangle given width, height and pixels.
list_ratios.c
:
- Takes arguments
w
, h
and d
, where (w, h)
are dimensions and
d
divides w
and h
.
- Returns all possible dimensions
(x, y)
such that d
divides both
x
and y
, and ordered s.t. the ratio x/y
is the closest to w/h
.
binder_org.py
:
- Binder organizer for music sheets or other compatible formats.
- Prints how a binder should be organized given a set of sheets.
- Output is ordered alphabetically and either categorized by author or
title's first letter.
- Load from file or directly through methods.
gentags.sh
:
- Generate ctags for a given library.
generate_all.sh
- Utility script for generating ctags for common libs.
generate_ttt.c
- Generate all possible endgame configurations of the tic-tac-toe game.
About
Bunch of snippets of various kinds and flavors.
Languages
Language:Shell 32.6%Language:C++ 27.5%Language:C 22.2%Language:Go 9.2%Language:Python 8.5%