Skip to content

Instantly share code, notes, and snippets.

setInterval(function() {
console.log('ping');
setTimeout(function() {
var hangoutChatIFrame = document.querySelector("#hangout-landing-chat").firstElementChild.contentWindow.document;
var conversationList = hangoutChatIFrame.querySelector("div[aria-label = Conversations]");
var firstChat = conversationList.firstElementChild.firstElementChild.firstElementChild;
firstChat.click();
setTimeout(function() {
var chatWindowIFrame = document.querySelector("body > .Cl").firstElementChild.contentWindow.document;
var settingsButton = chatWindowIFrame.querySelector("body > div > div:nth-child(3) > div > div > div > div > div > div > div:nth-child(2) > div > div > div > div > div:nth-child(2) button");
// document.querySelector("#messaging-view > div > md-content > div > gv-conversation-list > md-virtual-repeat-container > div > div.md-virtual-repeat-offsetter > div:nth-child(1) > div > gv-text-conversation-item > gv-conversation-item > div").click()
var interval = setInterval(function() {
console.log('ping');
const el = document.querySelector("md-menu")
.lastElementChild
.querySelector("md-menu-content > md-menu-item:nth-child(2) > button");
if (!el) {
console.log('done')
clearInterval(interval)
} else {
var bsplit = require('buffer-split');
function readLineJSON(path) {
const buf = fs.readFileSync(path);
const delim = Buffer.from('\n');
const result = bsplit(buf, delim);
return result
.map(x => x.toString())
.filter(x => x !== "")
.map(JSON.parse);
const readline = require('readline');
const arr = [];
const rl = readline.createInterface({
input: fs.createReadStream(path)
});
rl.on('line', function (line) {
arr.push(JSON.parse(line));
}).on('close', function() {
rl.close();
remote-dbshell-psql:
@echo Opening SSH Tunnel to the clavis-analytics database through an EC2 in the arc-multitenant VPC
ssh -M -S my-ctrl-socket -fnNT -L 50000:blahblah.blahblah.us-east-1.rds.amazonaws.com:5432 [email protected]
@echo Running PSQL
psql postgres://user:pass@localhost:50000/clavis_analytics
@echo Closing SSH Tunnel
ssh -S my-ctrl-socket -O exit [email protected]
#!/bin/bash
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
PROFILE="$1"
USERNAME="al.johri"
echo "Rotating keys for profile: '$PROFILE' and username: '$USERNAME'"
import subprocess
def import_thirdparty_module(libname, importname=None):
if not importname:
importname = libname
# http://stackoverflow.com/questions/25491541/python3-json-post-request-without-requests-library
try:
lib = __import__(importname)
except ImportError:
print("error: missing dependency '{libname}'\n"
import os
import argparse
import fnmatch
ignore_patterns = (
open('.dockerignore').read().splitlines() +
open('.gitignore').read().splitlines() +
['.git*'])
def relevant_paths(paths):
import requests
from urllib.parse import urlencode
from datetime import datetime, timezone
def jsonsearch(city, sort="date", **kwargs):
def process_post_json(post):
return {
'id': post['PostingID'],
'title': post['PostingTitle'],
#!/usr/bin/env python3
"""
Usage:
brew install tor
brew services start tor
pip3 install requests==2.10.0
pip3 install PySocks==1.5.7