Skip to content

Instantly share code, notes, and snippets.

@pjf
pjf / regexps-are-fabulous.pl
Created April 26, 2017 12:05
Here are great things you can do with regexp matching groups
#!/usr/bin/env perl
# These lines enable newer Perl features (like 'say'), and encourage
# good coding practices.
use v5.10;
use strict;
use warnings;
use autodie;
# Our script will search for strings in the following form:
@tmcw
tmcw / README.md
Created March 31, 2017 02:01
Managing GitHub Watching en masse

Managing GitHub Watching

I decided to unwatch many repos in multiple organizations. Here are two scripts that I wrote to make that possible. It works like:

  1. I load GitHubAccessToken in my environment, an environment variable that gives these access
  2. I run node get-all-watched.js > all-watching.txt to dump all watching into a text file
  3. Run grep "^developmentseed" all-watching > developmentseed.txt, for instance, to make a text file of only repos in the developmentseed org that I'm watching
  4. Run node unwatch-file-of-repos.js developmentseed.txt to unwatch all those repos.
@pburkholder
pburkholder / Note.md
Created March 14, 2017 12:11
Lean Agile Scrum Kanban

One of my colleagues at 18F asked in Slack:

I'm having a difficult time conceptualizing the difference between agile, lean, scrum, and kanban. Help! @channel

Leah Bannon jumped in with an excellent precis:

In short,

  • agile is a broad term that refers to the general ideas of individuals over interactions, working software over documentation, collaborating with customers, and changing/iterating. it’s more of a philosophy than a methodology.
  • lean, scrum, and kanban are methodologies that are guided by the philosophy of agile
  • lean is more designy and focuses on developing a hypothesis and then testing/researching to adjust or confirm it https://pages.18f.gov/lean-product-design/
@laurenancona
laurenancona / twitterUserInfoFunctions.gs
Last active November 19, 2021 12:51
Add custom functions to a Google sheet to pull user info directly from Twitter REST API
// Based on script by @SarahMarshall here:
// http://sarahmarshall.io/post/70812214349/how-to-add-twitter-follower-counts-to-a-google
var id = '@username'; // Replace with your username, then delete this line after running script 1st time
var CONSUMER_KEY = 'INSERT CONSUMER KEY'; // Create an application at https://dev.twitter.com
var CONSUMER_SECRET = 'INSERT CONSUMER SECRET'; // Create an application at https://dev.twitter.com
function getTwitterUserFollowers(id) {
@mjumbewu
mjumbewu / loadtest.py
Last active October 9, 2016 00:58
Simple load tester that continuously sends GET requests to a list of URLs for a given duration of time. Requires python libraries click and requests.
#!/usr/bin/env python
from __future__ import print_function, division
import click
import csv
from datetime import timedelta
from itertools import cycle
from queue import Queue
import requests
@mhawksey
mhawksey / GoogleAppsScript2GitHub.gs
Last active June 14, 2023 15:32
Example script that demonstrates how you can commit files to Github using Google Apps Script. If copying into a script project remembers to add a oAuth2 library https://github.com/googlesamples/apps-script-oauth2. More info in this post https://mashe.hawksey.info/?p=17293
/*
To use you need to create an application on Github at https://github.com/settings/developers
The callback in this needs to be set to https://script.google.com/macros/d/{SCRIPT ID}/usercallback
Where {SCRIPT ID} is the ID of the script that is using this library. You can find your script's ID in the Apps Script code editor by clicking on the menu item "File > Project properties".
In this example code I've stored the apllicaitons clientId and clientSecret in the Script Properties:
- git_clientId
- git_clientSecret
Direction Code Expanded Full Text Directional Abbreviation Spanish Translation
11 North N
12 South S
13 East E
14 West W
15 Northeast NE
16 Northwest NW
17 Southeast SE
18 Southwest SW
19 Norte N Y North
@chrisgoddard
chrisgoddard / json-ld-gtm.html
Last active July 23, 2023 16:52
JSON-LD GTM Tag
<script>
(function(){
var data = {
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{Page URL}}
},
"headline": {{SCHEMA - Article Headline}},
@bojanpopic
bojanpopic / backup_github_issues.sh
Last active May 20, 2020 09:34
A (dirty) bash script that will backup issues from the GitHub repo using API. It takes pagination into consideration. Originally created by @boombatower. Done under a hour, so it can be improved (grep anyone?), but hey, it's one time script and it works. What more do you need? :)
#!/bin/bash
repo="" # put the name of the repo here. Usually it is like this: organization/repo-name
username="" # your github username
password="" # your github password
numberofpages= # leave blank for now and script will help you find the number of pages
if [ -z $numberofpages ]
then
echo "No number of pages set, lets find out how many pages are there"
@CTimmerman
CTimmerman / SVG_to_PNG.js
Last active April 5, 2024 12:26
Convert SVG to PNG / save SVG as PNG
// SVG2PNG
// By Cees Timmerman, 2024-04-05.
// Paste into console and adjust indices as needed.
let im = document.getElementsByTagName('img')
let fname = location.href
if (im.length < 1) {
let svg = document.getElementsByTagName('svg')[0]
let bb = svg.getBBox()
im = new Image(bb.width, bb.height)
im.src = 'data:image/svg+xml;charset=utf-8;base64,' + btoa(document.getElementsByTagName('svg')[0].outerHTML)