Skip to content

Instantly share code, notes, and snippets.

View gsingh93's full-sized avatar

Gulshan Singh gsingh93

View GitHub Profile
@gsingh93
gsingh93 / markMutedAsRead.gs
Created September 4, 2021 04:27
Marked muted emails as read with Google AppsScript
// Create a new AppScript project (https://script.google.com/home/start)
// and schedule this to be run every hour
function markMutedAsRead() {
var threads = GmailApp.search('is:muted is:unread');
for (var i = 0; i < threads.length; i++) {
threads[i].markRead();
}
}
@gsingh93
gsingh93 / gdb_init_real_mode.txt
Created June 17, 2018 01:32
Mirror of this GDB script for debugging x86 16-bit real mode code: http://www.capp-sysware.com/misc/stackoverflow/gdb_init_real_mode.txt
# Special mode for GDB that allows to debug/disassemble REAL MODE x86 code
#
# It has been designed to be used with QEMU or BOCHS gdb-stub
#
# 08/2011 Hugo Mercier - GPL v3 license
#
# Freely inspired from "A user-friendly gdb configuration file" widely available
# on the Internet
set confirm off
@gsingh93
gsingh93 / print_heap_sizes.c
Created September 23, 2016 06:59
Print the requested, usable, and real sizes of a heap chunk
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main() {
printf("size of size_t: %zu\n", sizeof(size_t));
int i;
for (i = 0; i < 10; i++) {
size_t size = i * 8;
void *m = malloc(size);
@gsingh93
gsingh93 / setup-qemu-arm.sh
Created May 23, 2016 09:44
Installs and configures QEMU to run ARM binaries on Ubuntu 14.04
#!/bin/bash
URL=http://wiki.qemu-project.org/download/
latest_qemu=$(curl --silent $URL | grep -oP "\bqemu-[0-9.]+\.tar\.bz2\b" | sort | uniq | tail -n 1)
basename=$(basename $latest_qemu .tar.bz2)
if [[ ! -d $basename ]]; then
echo "[+] Downloading latest QEMU: $latest_qemu"
wget $URL/$latest_qemu
@gsingh93
gsingh93 / wpvuln.py
Created December 8, 2015 15:58
Check for WordPress plugin vulnerabilities
#!/usr/bin/env python2
import requests
import json
from pprint import pprint
wp_version = '4.3'
plugins = []
print '[+] Checking WordPress version ' + wp_version
git push -q -f heroku HEAD:master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Haskell app detected
remote:
remote:
remote: -----> Welcome to Haskell on Heroku
remote: BUILDPACK_URL: https://github.com/mietek/haskell-on-heroku
use std::io;
use std::str::FromStr;
use std::num::Float;
// http://codeforces.com/contest/1/problem/A
fn main() {
let l = io::stdin().read_line().unwrap();
// We need the .trim() because of the newline. Annoying
// Can't do it on one line because of lifetime error. Also annoying.
let l = l.trim();
@gsingh93
gsingh93 / find-dirty-git.sh
Created January 3, 2015 02:45
Finds git repos in a folder with a dirty index, uncommitted changes, or unpushed commits.
#!/bin/bash
# This script finds three types of Git repos
# 1. Repos that have a dirty index or uncommitted changes
# 2. Repos that have committed changes that aren't pushed to the remote branch
# 3. Repos that have no remote branch
#
# Type 2 only works with the master branch, and the others only work with the branch the repo is currently on
depth=3
@gsingh93
gsingh93 / loghw.sh
Created December 13, 2014 23:16
A script to log cpu usage, memory usage, and temperature usage
#!/bin/bash
# A script to log cpu usage, memory usage, and temperature usage
# TODO:
#
# Log temp awk is not portable
# Validate interval
#
@gsingh93
gsingh93 / toggle-lines-tail.el
Last active August 29, 2015 14:03
Toggle lines-tail in whitespace-style in whitespace-mode
(require 'whitespace)
(defun toggle-lines-tail ()
(interactive)
(let ((vic (member 'lines-tail whitespace-style)))
(progn
(if vic
(setq whitespace-style (delete 'lines-tail whitespace-style))
(add-to-list 'whitespace-style 'lines-tail))
(message "%s" whitespace-style))))