Skip to content

Instantly share code, notes, and snippets.

@raghur
raghur / decrypt pdf
Last active August 19, 2025 06:02
QPDF command to remove file restrictions from password protected pdf file.
# remove pdf file restrictions from password protected pdf file.
qpdf.exe --decrypt --password=verysecret input.pdf output.pdf
@raghur
raghur / powerwake
Created June 7, 2017 07:20
powerwake script
#! /usr/bin/python
#
# powerwake - a smart remote host waking utility, supporting multiple
# waking methods, and caching known hostnames and addresses
#
# Copyright (C) 2009 Canonical Ltd.
#
# Authors: Dustin Kirkland <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
@raghur
raghur / make-ovpn.sh
Created May 9, 2017 07:16
Generate ovpn file using .crt and .key
#!/bin/bash
export OVPN_CLIENT=$1
perl -pe 's#;cert;#open+F,"$ENV{'OVPN_CLIENT'}.crt";join"",<F>#ge' client.conf.template > $1.ovpn
perl -pe 's#;key;#open+F,"$ENV{'OVPN_CLIENT'}.key";join"",<F>#ge' -i $1.ovpn
export OVPN_CLIENT=
@raghur
raghur / proxy.pac
Last active August 5, 2024 02:52
Proxy pac file for switching proxy based on IP - works with Firefox & Chromium.
function FindProxyForURL(url, host)
{
// firefox - Ctrl-Shift-J Chrome/Chromium: chrome://net-internals/#events
var debug = true;
var log = function() {
if (debug) {
var args = Array.prototype.slice.call(arguments);
alert(args.join(" "));
}
}
# look for installed packages
apt list --installed
# aptitude search installed ~i
# scale all deployments to 0 on k8s
$ kubectl get deployments -o jsonpath={.items[*].metadata.name} |xargs -d ' ' -I '{}' kubectl scale deployment --replicas=0
deployment "auth-service" scaled
deployment "demo-application" scaled
deployment "demo-gateway" scaled
deployment "hystrix" scaled
deployment "opining-worm-rabbitmq" scaled
deployment "webapi-app" scaled
@raghur
raghur / push.sh
Created January 27, 2017 15:47
Bash script to send messages using pushover
#!/bin/bash
# getopt arg parsing magic
# SO - entirely from http://stackoverflow.com/a/29754866/287085
getopt --test > /dev/null
if [[ $? -ne 4 ]]; then
echo "I’m sorry, `getopt --test` failed in this environment."
exit 1
fi
@raghur
raghur / azurevm.ps1
Created January 27, 2017 14:04
Start/stop VM using azure automation
param (
[string] $action,
[string] $resourcegroup,
[string] $vmname
)
function Send-Push{
param(
[string] $action,
[string] $vmname,
@raghur
raghur / Class1.cs
Created August 4, 2016 19:58
Nspec sample used for PR# 132 on NSpec
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NSpec;
namespace NspecSample
{
@raghur
raghur / README.md
Last active May 18, 2016 17:05
Compiling vim with mingw

Problems

for some reason, colorschemes don't seem to work well...