Skip to content

Instantly share code, notes, and snippets.

View uzluisf's full-sized avatar
💼
On the hunt...

Luis Uceta uzluisf

💼
On the hunt...
View GitHub Profile
@uzluisf
uzluisf / usefulpacman.md
Created June 29, 2017 15:45
A short list of pacman commands

Syncing

pacman -Sy          #sync the database

pacman -Syy         #sync the database even if it's up to date

Updating

Let's say I have the following module:

module Simple-Mod;

#| Calculate the nth fibonacci number.
multi fib( 0 ) { 1 }
multi fib( 1 ) { 1 }
multi fib( Int $n where * > 1 ) {
    fib($n - 2 ) + fib($n - 1);
@uzluisf
uzluisf / mathy.tex
Created January 13, 2019 02:42
A simple LaTex template for Math homeworks.
% Resources:
% http://www-math.mit.edu/~psh/exam/examdoc.pdf
% https://www.math.uni-bielefeld.de/~rost/amslatex/doc/amsthdoc.pdf
\documentclass[addpoints,answers,12pt]{exam} % exam class with 12 point type
\usepackage[T1]{fontenc} % replace default font encoding (OT1)
\usepackage{tgschola} % font used in the Book of Proof
\usepackage{amsmath,amsthm,amssymb,amsfonts} % packages for mathematical typesetting
\usepackage{pdfpages} % include pdf pages with \includepdf{dir/of/page.pdf}
\usepackage[makeroom]{cancel} % display expressions as cancelled
@uzluisf
uzluisf / ProjectFour.pm6
Created April 20, 2019 17:06
Project 4 for CS253 implemented in Raku Perl 6
unit module ProjectFour;
=begin pod
=TITLE ProjectFour
=SUBTITLE Find a route in map by backtracking using a Stack
The module C<ProjectFour> implements two classes (C<City> and C<RouteMap>)
to find a route, if one exists, from an origin city to a destination city,
given a particular map. In a map, a city B is adjacent to a city A if there's
an arrow pointing from A to B. For example, in N->Q we say that Q is adjacent

Word Ladder

A word ladder is a sequence of words [w0, w1, ..., wn] such that each word wi in the sequence is obtained by changing a single character in the word wi-1. All words in the ladder must be valid English words.

Given two input words and a file that contains an ordered word list, implement a routine (e.g., find_shortest_ladder(word1, word2, wordlist)) that finds the shortest ladder between the two input words. For example, for the words cold and warm, the routine might return:

("cold", "cord", "core", "care", "card", "ward", "warm")
@uzluisf
uzluisf / iters.md
Created January 13, 2020 16:53
Iterators and Iterables in Raku [Draft]

Iteration, Iterables, and Iterators in Raku.

What's iteration?

As general concept, iteration can be defined as the process of doing some repeated action over something in order to generate a sequence of outcomes. At a more detailed and programmatic level, iteration is the process of visiting all the elements of an iterable object using another object known as an iterator.

@uzluisf
uzluisf / delegation-raku.rakudoc
Last active March 8, 2020 14:00
Short write-up about delegation in Raku
=begin pod
X<|Delegation>
=head2 Delegation
Delegation is a technique whereby a member of an object (the I«delegatee») is
evaluated in the context of another original object (the I«delegator»). In other
words, all method calls on the delegator are I«delegated» to the delegatee.
In Raku, delegation is specified by applying the L«handles|/language/typesystem#trait_handles»
trait to an attribute. The arguments provided to the trait specify the methods
=begin pod :kind("Language") :subkind("Language") :category("tutorial")
=TITLE Iterating
=SUBTITLE Functionalities available for visiting all items in a complex data structure
Similar to other many programming languages, Raku makes a fine distinction among
the terms I<iteration>, I<iterable>, and I<iterator>. Familiarizing yourself
with them is key for understanding the Raku constructs that implement these
concepts:
@uzluisf
uzluisf / git-commands-chain.md
Created December 19, 2020 14:43
Git Commands I Forget Too Often

Keeping fork up to date

git clone /url/to/original/repo                     # clone fork
git remote add upstream /url/to/original/repo       # add remote from original repo
git fetch upstream                                  # fetch content from upstream (i.e., repo forked from)
git pull upstream master                            # fetch and merge upstream into master

Clean up fork and restart from upstream

@uzluisf
uzluisf / data.json
Last active June 15, 2022 23:00
Simple JSON API
{
"recipes": [
{
"name": "scrambledEggs",
"ingredients": [
"1 tsp oil",
"2 eggs",
"salt"
],
"instructions": [