This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/awk -f | |
# Under Public Domain | |
{ | |
delete a; b = 0 | |
$0 = tolower($0) | |
# Compacting for mmultiletter Combinational Emojis: | |
gsub("ab", "A") # :ab: | |
gsub("abc", "B") # :abc: | |
gsub("atm", "T") # :atm: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chmdc.c, Linux permissions visualizer | |
// By Oliver Webb (2024), Inspired by cheat.sh/chmod/####, In Public Domain | |
#include <stdio.h> | |
#include <stdlib.h> | |
char *propnames[3] = {"Read ", "Write", "Exec "}, | |
*specnames[3] = {"Setuid", "Setgid", "Sticky"}; | |
int main(int argc, char *argv[]) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <math.h> | |
extern int printf(const char *format, ...); | |
extern long timezone; | |
#define isleap(y) ((!(y % 4)) ? ((!(y % 100)) ? !(y % 400) : 1) : 0) | |
#define INT(x) ((int)(x)) | |
#define FRACP(x) ((x)-INT(x)) | |
// HEADER: include/astrotime.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementation of luhn's algorithm | |
// See: https://cs50.harvard.edu/x/2024/psets/1/credit/ | |
// This code is in the public domain | |
// TODO: Credit card type checking | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
static void invalid() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ordinal Indicator | |
#include <stdio.h> | |
#include <stdlib.h> | |
static const char *ordindic(long num) | |
{ | |
int lpr = abs(num % 100); | |
if (lpr >= 11 && lpr <= 14) lpr = 0; | |
lpr %= 10; | |
if (lpr > 3 || !lpr) return "th"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <arpa/inet.h> | |
int main(int argc, char **argv) | |
{ | |
char *colors[] = { | |
"Greyscale", "INVALID", "RGB", "Indexed Color", | |
"Greyscale w/ alpha", "INVALID", "RGBA" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <byteswap.h> | |
void swapf(void *mem, const char *fmt) | |
{ | |
char *m = (char *)mem; | |
for (;;fmt++) switch (*fmt) { | |
case '1': case 'b': | |
m++; | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "math" | |
import "time" | |
func main() { | |
tz, err := time.LoadLocation("UTC") | |
if err != nil { // Always check errors even if they should not happen. | |
panic(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# bigcal - make a 78-column version of the output of the "cal" command | |
# | |
# Pass it the same arguments you'd pass to cal, if any. If you try a | |
# full-year calendar, you probably won't get anything useful. | |
# | |
# Jef Poskanzer <jef@mail.acme.com> | |
cal "$@" | awk 'NR == 1 {printf "%s%s\n", substr(" ", length/2), $0}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DELAY="0" | |
MODE="D" | |
VIEWER="nsxiv" | |
SHOTPROMPT='1:Take shot\n2:Mode Change\n3:Delay+5s\n4:Delay-5s' | |
while true; do | |
SELITEM=$(printf "$SHOTPROMPT" | dmenu -h 16 -l 4 -p "Mode:$MODE Del:$DELAY") |
OlderNewer