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 March 16, 2025 05:23
Test tree, as of 2025-03-16T05:23:42Z
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;
#!perl
use strict;
use warnings;
use diagnostics;
`latexmk -xelatex -pdf ~/texRepo/HouseWarmingInvitation.tex`;
`mv HouseWarmingInvitation.pdf ~/public_html`;
`pdfseparate ./public_html/HouseWarmingInvitation.pdf public_html/invitees/%d`;
`rm -f ~/HouseWarmingInvitation.*`;
open my $tex, '/home/ec2-user/texRepo/HouseWarmingInvitation.tex' or die "$!";