Skip to content

Instantly share code, notes, and snippets.

@saagarjha
saagarjha / git-ps1-status
Last active April 1, 2017 17:23
A Git summary for your Bash PS1 prompt
#!/usr/local/bin/bash
# Make sure this runs on a modern bash with support for ;;& in case
shopt -s extglob
# Make sure we're in a git directory
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
# Print a leading space to separate from the rest of the PS1
echo -n " "
# Check our status relative to upstream
@saagarjha
saagarjha / GmailLabelArchive.gs
Created October 20, 2016 02:04
Google Apps Script to archive old emails in a label
function shouldStop(startTime) {
return new Date().getTime() - startTime.getTime() > 300000; // 5 minutes
}
function archive() {
var days = 7; // How old a message must be to be archived
var startTime = new Date();
var date = new Date();
date.setDate(date.getDate() - days);
var label = GmailApp.getUserLabelByName("[LABEL NAME]");
@saagarjha
saagarjha / .conkyrc
Last active December 1, 2016 06:30
A (modified) Google Now-inspired .conkyrc
# If you haven't already, download Conky Google Now from http://satya164.deviantart.com/art/Conky-Google-Now-366545753 and unzip it to your home folder; then copy this .conkyrc over the one you just extracted
# Requires lm-sensors and inxi (and conky) to be installed:
# sudo apt-get install lm-sensors inxi
# Adapted from these:
# http://satya164.deviantart.com/art/Conky-Google-Now-366545753
# https://gist.github.com/anonymous/6666594
# Conky Google Now style #
@steipete
steipete / openssl-build.h
Last active May 30, 2023 11:34
Updated script that builds OpenSSL with Bitcode enabled (tested with Xcode 7.0b3)
#!/bin/bash
# This script downlaods and builds the iOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# Peter Steinberger, PSPDFKit GmbH, @steipete.
set -e