Skip to content

Instantly share code, notes, and snippets.

View jgn's full-sized avatar
☂️
Messing around.

John Norman jgn

☂️
Messing around.
View GitHub Profile
@Integralist
Integralist / 1. Sumo Filter Explanation.md
Last active July 19, 2022 14:10
Demonstrates how to use Sumo Logic query language

Take log message and parse as JSON (create new column jsonobj):

parse "*" as jsonobj

Take new jsonobj column and create a new column for the specified key in the JSON:

json field=jsonobj "my-obj-key"
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active May 6, 2024 16:55
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete
@wm
wm / hangout
Last active December 12, 2015 02:48 — forked from drinks/hangout
#!/usr/bin/env ruby
### make sure you `brew install chromedriver` and `gem install selenium-webdriver` before running this!
require 'rubygems'
require 'selenium-webdriver'
hangout_url = ENV['hangout_url']
hangout_email = ENV['hangout_email']
hangout_password = ENV['hangout_password']
@jgn
jgn / OrderedSet
Created April 10, 2011 03:28
OrderedSet leveraging ActiveSupport::OrderedHash to get predictable behavior across 1.8.x, 1.9.x
# Force the underlying store for a Set to be an OrderedHash.
class OrderedSet < Set
def initialize(enum = nil, &block)
@hash ||= ActiveSupport::OrderedHash.new
super
end
end
@jgn
jgn / radix50.rb
Created November 20, 2010 02:14
rad50
#!/usr/bin/env ruby
# http://en.wikipedia.org/wiki/RADIX-50
class String
R50_CHARS = " ABCDEFGHIJKLMNOPQRSTUVWXYZ$.%0123456789"
R50_LOOKUP = {}.tap { |h| String::R50_CHARS.split(//).each_with_index { |c, i| h[c] = i } }
R50_CLEAN = /[[:upper:]|[:digit:]| |.|$|%]/
def radix50
[].tap do |r|
self.upcase.scan(R50_CLEAN).inject([]) do |m, c|
m << R50_LOOKUP[c]