Skip to content

Instantly share code, notes, and snippets.

View hasandiwan's full-sized avatar
💭
Fixing bugs, always

Hasan Diwan hasandiwan

💭
Fixing bugs, always
View GitHub Profile
@hasandiwan
hasandiwan / AgeTests.java
Last active May 4, 2024 12:55
Test tree, as of 2024-05-04T05:55:14-07:00
package us.d8u.balance;
import java.util.Map;
import java.util.Set;
import org.apache.http.HttpStatus;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.junit.Assert;
import org.junit.Test;
@hasandiwan
hasandiwan / gpgboard.py
Last active January 5, 2022 08:26
Python script to sign the contents and verify PGP-signed content on your Windows/Mac/Linux clipboard
import argparse
import os
import sys
import gnupg
import pyperclip
parser = argparse.ArgumentParser(
description="GPG clearsign whatever is on your clipboard and copy the signed data back"
)
@hasandiwan
hasandiwan / fileAgeInDays.c
Created June 1, 2023 08:01
Port of perl's -M function to C
#include <stdio.h>
#include <sys/stat.h>
#include <time.h>
int main(int argc, char **argv) {
struct stat sb;
int rv;
rv = stat(argv[argc-1], &sb);
fprintf(stdout, "%ld\n", (time(NULL)-sb.st_atime)/86400);
return rv;