Skip to content

Instantly share code, notes, and snippets.

View dangarbri's full-sized avatar

Daniel Garcia-Briseno dangarbri

View GitHub Profile
@dangarbri
dangarbri / segfaulter
Created November 14, 2023 03:21
Send segfault to the specified program as soon as it starts.
while true; do
kill -SIGSEGV $(ps -a | grep $1 | cut -d' ' -f 2) 2> /dev/null
done
@dangarbri
dangarbri / crypt.c
Created November 10, 2023 18:26
crypt, since it exists only as a c function and not a binary
#include <unistd.h>
#include <stdio.h>
int main(int argc, char** args) {
if (argc < 3) {
printf("Usage: %s password salt\n", args[0]);
}
printf("%s\n", crypt(args[1], args[2]));
}
@dangarbri
dangarbri / Makefile
Last active May 18, 2024 21:08
Makefile for building programs with cosmopolitan libc
# License: MIT
# Copyright (c) 2022 Daniel Garcia-Briseno
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@dangarbri
dangarbri / Makefile
Created May 8, 2022 13:37
small program to calculate the sum of the first n prime numbers
all:
gcc -g -o sum_prime sum_prime.c number_parser.c -lm
@dangarbri
dangarbri / .emacs
Created April 13, 2022 14:18
.emacs
;; Add melpa stable repository
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/")
'("nongnu" . "https://elpa.nongnu.org/nongnu/"))
(package-initialize)
;; (setq auto-save-default nil)
;; (setq create-lockfiles nil)
@dangarbri
dangarbri / addtopath
Last active April 7, 2022 14:35
Automatically add new folders to your path without needed to manually edit a script
#!/usr/bin/env bash
# Copyright (c) 2022 Daniel Garcia-Briseno
# Written: 2022-04-06
# Updated: 2022-04-07 - added customization with the environment variable
# ADDTOPATH_TARGET
# - Added ability to request sudo permission
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@dangarbri
dangarbri / getpass
Created March 14, 2022 15:35
Quick lesspass shortcut. Usage `getpass website.com your_username` then enter master password and your password is saved to your clipboard
#!/usr/bin/python3
COUNTER="1"
LENGTH="16"
from getpass import getpass
import lesspass.core as lesspass
import sys
def main(site, username, extra_args):
@dangarbri
dangarbri / amex_everydollar_integration.py
Last active December 24, 2022 16:54
Continuously integrate transactions from American Express into the EveryDollar budgeting app.
"""
Uses selenium based APIs for American Express and Everydollar
continuously import transactions into everydollar.
Since everydollar doesn't natively support linking an American Express account
"""
from amex_selenium import AmexAPI
from everydollar_api import EveryDollarAPI
from time import sleep