Skip to content

Instantly share code, notes, and snippets.

View grimsy's full-sized avatar

Geoff Jacobs grimsy

  • Sydney, Australia
View GitHub Profile
@tokland
tokland / puppeteer-click-by-text.js
Last active August 11, 2023 03:48
Click link by text in Puppeteer
const puppeteer = require('puppeteer');
const escapeXpathString = str => {
const splitedQuotes = str.replace(/'/g, `', "'", '`);
return `concat('${splitedQuotes}', '')`;
};
const clickByText = async (page, text) => {
const escapedText = escapeXpathString(text);
const linkHandlers = await page.$x(`//a[contains(text(), ${escapedText})]`);
@kbeswick
kbeswick / locustfile.py
Last active April 29, 2016 05:06
Quicksearch locustfile.py example
#!/usr/bin/python
from locust import HttpLocust, TaskSet, task
import random
terms = [
'chemistry', 'physics', 'biology', 'computer science',
'web of science', 'google scholar', 'refworks', 'pubmed',
'ieee', 'jstor', 'scifinder', 'morningstar', 'petition',
'citation builder', 'nature', 'science', 'proquest', 'naxos',
@mackstann
mackstann / gist:4229933
Created December 7, 2012 01:16
Gigantic recursive directory lister
// http://www.olark.com/spw/2011/08/you-can-list-a-directory-with-8-million-files-but-not-with-ls/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
@JuanCanham
JuanCanham / gist:2917132
Created June 12, 2012 12:02
Simple Google Apps script to update signatures accross a domain
function getSignature() {
//pretty basic function for testing
if ( startupChecks()) { return; }
var email = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getValue().toString();
if ( email === "" ) {
Browser.msgBox("No email selected", "Please select a cell containing a user's email" , Browser.Buttons.OK);
return;
}
var result = authorisedUrlFetch(email, {});
Browser.msgBox(result.getContentText());