Skip to content

Instantly share code, notes, and snippets.

View ghoomfrog's full-sized avatar
🪰
losin'

ghoom ghoomfrog

🪰
losin'
  • Agadir, Morocco
  • 06:17 (UTC +01:00)
  • Reddit u/Unlimiter
View GitHub Profile
@ghoomfrog
ghoomfrog / Repeat.psm1
Last active September 1, 2021 20:47
Keep invoking an expression between an interval. Similarly to Unix's watch command.
# Put this in 'C:\Program Files\WindowsPowerShell\Repeat\Repeat.psm1'.
function Repeat {
param(
$expression,
$interval = 2,
[switch]$clearScreen = $False
)
if ($expression) {
while (1) {
if ($clearScreen) {cls}
@ghoomfrog
ghoomfrog / gel
Last active August 10, 2021 00:38
Script to download images from Gelbooru.
#!/bin/sh
# Dependencies: curl, wget, jq
escape_special_url_characters() { # print arguments after escaping special URL characters in them
echo $@ |
sed 's/%/%25/g; s/\$/%24/g; s/&/%26/g; s/\+/%2B/g; s/,/%2C/g;
s/\//%2F/g; s/:/%3A/g; s/;/%3B/g; s/=/%3D/g; s/\?/%3F/g;
s/@/%40/g; s/ /%20/g; s/"/%22/g; s/</%3C/g; s/>/%3E/g;
s/#/%23/g; s/{/%7B/g; s/}/%7D/g; s/|/%7C/g; s/\\/%5C/g;
s/\^/%5E/g; s/~/%7E/g; s/\[/%5B/g; s/]/%5D/g; s/`/%60/g;'
@ghoomfrog
ghoomfrog / htable.h
Last active August 9, 2021 02:46
Hash Table Facilities
#ifndef HTABLE_H
#define HTABLE_H
#define HTABLE_INITIAL_CAPACITY 64
#include <stdlib.h>
#include <string.h>
typedef struct htable_t {
char **keys;
void **values;
@ghoomfrog
ghoomfrog / darray.h
Last active August 9, 2021 02:46
Dynamic Array Facilities
#ifndef DARRAY_H
#define DARRAY_H
#define DARRAY_INITIAL_CAPACITY 64
#include <stdlib.h>
#include <string.h>
typedef struct darray_t {
size_t length, capacity;
void **elements;
@ghoomfrog
ghoomfrog / crypt.c
Created May 23, 2021 04:09
The crypt function from unistd.h as a command.
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char **argv) {
if (argc > 1) {
if (argc > 2) {
char salt[3];
salt[0] = *argv[2];
if (strlen(argv[2]) < 2)

Keybase proof

I hereby claim:

  • I am ghoomy on github.
  • I am ghoomy (https://keybase.io/ghoomy) on keybase.
  • I have a public key ASDVGQWhmo_Y2QPaFanfrXqv_p2EydST1R9eA8AzFPGEBwo

To claim this, I am signing this object:

@ghoomfrog
ghoomfrog / oop.lua
Last active January 17, 2020 15:16
Simple OOP functions for Lua.
--[[
MIT License
Copyright (c) 2019 Unlimiter
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
@ghoomfrog
ghoomfrog / uvector.h
Last active February 8, 2023 17:13
My vector implementation for C.
/* MIT License
Copyright (c) 2019-2020 Unlimiter
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:
@ghoomfrog
ghoomfrog / sum.c
Created June 5, 2019 02:17
Program to quickly sum integers from a start to an end.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
// if at least 2 arguments are given to the program
if (argc > 2) {
// first integer
long long f = atoll(argv[1]);
// last integer
long long l = atoll(argv[2]);
@ghoomfrog
ghoomfrog / code.c
Last active June 5, 2019 02:20
Program to get ASCII codes of characters.
#include <stdio.h>
int main(int argc, char** argv) {
// if at least an argument is given to the program
if (argc > 1) {
// loop through first argument
for (int i = 0; argv[1][i] != 0; i++)
// print integer representation of character at i
printf("%i ", argv[1][i]);
puts("");