Skip to content

Instantly share code, notes, and snippets.

View rishid's full-sized avatar

Rishi Dhupar rishid

  • Boston, MA
View GitHub Profile
@rishid
rishid / gist:7793425943dd3f9721d1bdfc2676668d
Last active February 12, 2024 20:24
Time a command for N iterations and print out the average real/user/sys time used
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <command> <repeat>"
exit 1
fi
command="$1"
repeat="$2"
@rishid
rishid / dupefixer.js
Created January 2, 2021 22:15 — forked from Talon876/dupefixer.js
Mint Duplicate Transaction Fixer
/*
* This script is meant to be copy/pasted in to the Chrome javascript console while logged in to Mint.
* It can be used to find all of the transactions that you have checked "This is a duplicate" for.
* Once all of these transactions are found, you can then have the script add a 'Duplicate' tag to
* each of the transactions.
*
* This will then allow you to filter out duplicate transactions after exporting them to CSV as tags are included.
*
* You may need to replace the value of the duplicateTagId variable after this comment.
* To find the Duplicate tag id, edit a transaction and view the list of tags.
@rishid
rishid / MatrixAbsense iMacro
Created March 10, 2020 10:57
iMacro for assisting in reporting intermittent absenses on MatrixAbsense website. Choose date and run macro.
VERSION BUILD=10021450
TAG POS=1 TYPE=SELECT FORM=NAME:iarForm ATTR=ID:absenceStartTime CONTENT=%string:12:00<SP>AM
TAG POS=1 TYPE=SELECT FORM=NAME:iarForm ATTR=ID:hoursabsent CONTENT=%number:8
TAG POS=1 TYPE=I ATTR=CLASS:fa<SP>fa-pencil<SP>left-icon&&TXT:
TAG POS=1 TYPE=BUTTON ATTR=TXT:Ok
{
"error": false,
"span": 6,
"editable": true,
"type": "graph",
"id": 2,
"datasource": null,
"renderer": "flot",
"x-axis": true,
"y-axis": true,
"flotcharts error" Error: Invalid dimensions for plot, width = 912, height = 0
Stack trace:
b.prototype.resize@http://localhost:8080/app/app.ea6afffd.js:20:12606
b@http://localhost:8080/app/app.ea6afffd.js:19:14284
t@http://localhost:8080/app/app.ea6afffd.js:19:21013
c@http://localhost:8080/app/app.ea6afffd.js:20:12321
a.plot@http://localhost:8080/app/app.ea6afffd.js:20:15111
a@http://localhost:8080/app/app.ea6afffd.js:22:26044
k@http://localhost:8080/app/app.ea6afffd.js:22:27053
.link/<@http://localhost:8080/app/app.ea6afffd.js:22:30540
[CpuStats]
type = "FilePollingInput"
ticker_interval = 5
file_path = "/proc/loadavg"
decoder = "CpuStatsDecoder"
[CpuStatsDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/linux_cpustats.lua"
@rishid
rishid / udp_send_bm.c
Created February 23, 2014 22:28
udp sendto micro benchmark
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
12:22:42.551 Use of getUserData() or setUserData() is deprecated. Use WeakMap or element.dataset instead. requestNotifier.js:64
12:22:42.641 Unknown pseudo-class or pseudo-element '-webkit-scrollbar-button'. Ruleset ignored due to bad selector. bootstrap.dark.min.css:9
12:22:42.641 Unknown pseudo-class or pseudo-element '-webkit-scrollbar-track-piece'. Ruleset ignored due to bad selector. bootstrap.dark.min.css:9
12:22:42.641 Unknown pseudo-class or pseudo-element '-webkit-scrollbar-thumb'. Ruleset ignored due to bad selector. bootstrap.dark.min.css:9
12:22:42.643 Unknown property '-moz-border-radius'. Declaration dropped. timepicker.css:9
12:22:42.643 Error in parsing value for 'background-image'. Declaration dropped. timepicker.css:9
12:22:42.643 Expected color but found 'top'. Error in parsing value for 'background-image'. Declaration dropped. timepicker.css:9
12:22:42.643 Expected 'none' or URL but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. timepicker.css:9
12:22:4
@rishid
rishid / bash extract archive function
Created July 31, 2013 17:34
bash extract archive function
# extract different archives automatically
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
@rishid
rishid / bitmask macro
Created December 27, 2012 16:28
Great macro for building bitmask in C
#include <stdio.h>
#define BITMASK(H,L) ( (2ULL<<(H))-(1ULL<<(L)) )
int main()
{
printf("bitmask is %08X\n", BITMASK(4,3));
printf("bitmask is %08X\n", BITMASK(63,0));
printf("bitmask is %08X\n", BITMASK(63,2));
printf("bitmask is %08X\n", BITMASK(31,17));