Skip to content

Instantly share code, notes, and snippets.

View jonmaim's full-sized avatar
🌍
Back in Europe!

Jon Maim jonmaim

🌍
Back in Europe!
View GitHub Profile
@jonmaim
jonmaim / import_migration.json
Created June 22, 2020 15:48
Migration to Android X
{
"android.arch.core.executor.AppToolkitTaskExecutor": "androidx.arch.core.executor.AppToolkitTaskExecutor",
"android.arch.core.executor.ArchTaskExecutor": "androidx.arch.core.executor.ArchTaskExecutor",
"android.arch.core.executor.DefaultTaskExecutor": "androidx.arch.core.executor.DefaultTaskExecutor",
"android.arch.core.executor.JunitTaskExecutorRule": "androidx.arch.core.executor.JunitTaskExecutorRule",
"android.arch.core.executor.TaskExecutor": "androidx.arch.core.executor.TaskExecutor",
"android.arch.core.executor.TaskExecutorWithFakeMainThread": "androidx.arch.core.executor.TaskExecutorWithFakeMainThread",
"android.arch.core.executor.testing.CountingTaskExecutorRule": "androidx.arch.core.executor.testing.CountingTaskExecutorRule",
"android.arch.core.executor.testing.InstantTaskExecutorRule": "androidx.arch.core.executor.testing.InstantTaskExecutorRule",
"android.arch.core.internal.FastSafeIterableMap": "androidx.arch.core.internal.FastSafeIterableMap",
@jonmaim
jonmaim / timezoneConversions.json
Created April 23, 2020 10:02 — forked from danderson00/timezoneConversions.json
Convert Windows time zone names to IANA names. Derived from http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml using the `001` territory for each zone.
{
"Dateline Standard Time": "Etc/GMT+12",
"UTC-11": "Etc/GMT+11",
"Aleutian Standard Time": "America/Adak",
"Hawaiian Standard Time": "Pacific/Honolulu",
"Marquesas Standard Time": "Pacific/Marquesas",
"Alaskan Standard Time": "America/Anchorage",
"UTC-09": "Etc/GMT+9",
"Pacific Standard Time (Mexico)": "America/Tijuana",
"UTC-08": "Etc/GMT+8",

Keybase proof

I hereby claim:

  • I am jonmaim on github.
  • I am jonmaim (https://keybase.io/jonmaim) on keybase.
  • I have a public key ASAgVwTEflcw0rY7tZrrAsdtyV1mEFhD2twakOr-WtShMgo

To claim this, I am signing this object:

@jonmaim
jonmaim / get_commenters_from_last_post.js
Created December 16, 2018 15:48
Get the commenters list from your last Steem post
'use strict';
/* to be filled up */
const selfName = 'jonmaim';
const postingWif = 'xxx';
const steem = require('steem');
const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms));
@jonmaim
jonmaim / bot1.js
Last active November 29, 2018 15:08
First steem voting bot
'use strict';
const steem = require('steem');
/* to be filled up */
const selfName = '';
const postingWif = '';
const eol = '\n';
@jonmaim
jonmaim / oauth_node_example.js
Created March 21, 2017 10:53
OAuth 1.0 3-legged server side flow (motorsportreg example)
'use strict';
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var localtunnel = require('localtunnel');
var request = require('request');
var qs = require('querystring');
var url = require('url');
var http = require('http');
@jonmaim
jonmaim / jqlite2html.js
Last active March 20, 2017 11:58
Karma tests jqlite element HTML beautifier - adapted from http://stackoverflow.com/a/26361620/418831
function format(node, level) {
var indentBefore = new Array(level++ + 1).join(' ');
var indentAfter = new Array(level - 1).join(' ');
var textNode;
for (var i = 0; i < node.children.length; i++) {
textNode = document.createTextNode('\n' + indentBefore);
node.insertBefore(textNode, node.children[i]);
format(node.children[i], level);
if (node.lastElementChild === node.children[i]) {
@jonmaim
jonmaim / index.js
Last active December 31, 2016 08:56
Load JSON file
module.exports = function(path, cb) {
var xhr = new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.open('GET', path, true);
xhr.onreadystatechange = function() { xhr.readyState === 4 && xhr.status === 200 && cb(JSON.parse(xhr.responseText)); };
xhr.send(null);
};
@jonmaim
jonmaim / iterate_bouncing_email_mbox.js
Last active October 25, 2016 05:04
Iterate over emails in a .mbox file and output bouncing emails
var Mbox = require('node-mbox');
var MailParser = require("mailparser").MailParser;
var mbox = new Mbox('inbox.mbox', { /* options */ });
var bouncingEmails = [];
mbox.on('message', function(msg) {
var mailparser = new MailParser();
mailparser.on("end", function(mail) {
@jonmaim
jonmaim / iterate_dbs.js
Last active February 13, 2019 07:22
Mongo shell: iterate over all dbs
/* switch to admin database and get list of databases */
db = db.getSiblingDB("admin");
dbs = db.runCommand({ "listDatabases": 1 }).databases;
/* iterate through each database and get its collections */
dbs.forEach(function(database) {
print(database.name);
db = db.getSiblingDB(database.name);
cols = db.getCollectionNames();