Skip to content

Instantly share code, notes, and snippets.

View ghoomfrog's full-sized avatar
💭
losing

ghoom ghoomfrog

💭
losing
  • Agadir, Morocco
  • 14:48 (UTC +01:00)
  • Reddit u/Unlimiter
View GitHub Profile
@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 / 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 / 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}