Skip to content

Instantly share code, notes, and snippets.

View mateoppalacios's full-sized avatar
🎯
Focusing

Mateo Palacios mateoppalacios

🎯
Focusing
  • Quito, Ecuador
  • 00:19 (UTC -12:00)
View GitHub Profile
#!/bin/bash
# Might change this later.
((EUID == 0)) && printf "Can't run as root, quitting.\n" && exit 1
shopt -s expand_aliases
alias dots="/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME"
alias sxi="sudo xbps-install -y"
audio_setup=false
@mateoppalacios
mateoppalacios / tinyfetch
Created July 29, 2021 09:18
A tiny fetching utility for Linux.
#!/usr/bin/env bash
n=printf\ "\n"; i="${TF_INFO:=title os kernel host uptime memory shell colors}"
c="\e[1;${TF_COLOR-34}m"; r="\e[0m"; for o in $i; do case "$o" in title)
printf "${c}%s${r}@${c}%s\n" "$USER" "$HOSTNAME" ;; os) [ -f /etc/os-release ]\
&& { . /etc/os-release; printf "${c}OS${r}\t%s\n" "$NAME"; } ;; kernel)
printf "${c}Kernel${r}\t%s\n" "$(uname -r)" ;; host) printf \
"${c}Host${r}\t%s\n" "$HOSTNAME" ;; uptime) t="$(cat /proc/uptime)"; printf \
"${c}Uptime:${r}\t%s\n" "$(date -d@${t%% *} -u +%H:%M:%S)" ;; memory) printf \
"${c}Memory:${r}\t%s\n" "$(free -h | awk 'NR == 2 { printf("%s/%s\n", $3, $2) \
@mateoppalacios
mateoppalacios / brainfuck.c
Created June 20, 2021 04:42
Basic brainfuck interpreter in C.
#include <stdio.h>
#define T_LEN 30000
int main (void)
{
unsigned char tape[T_LEN] = {0};
unsigned char *pointer = tape;
char inp_tape[T_LEN];
@mateoppalacios
mateoppalacios / cowsay
Last active July 29, 2021 10:37
Simple fetching tool for UNIX like systems, that pipes to cowsay.
#!/bin/sh
# Cowfetch - Simple fetching tool for UNIX like systems, that pipes to cowsay.
# Check if cowsay is installed.
if [ "$(command -v cowsay | wc -l)" = 0 ]; then
printf "cowsay isn't installed.\n"
exit 1
fi