Skip to content

Instantly share code, notes, and snippets.

@itst
itst / checkPermissions.php
Last active January 24, 2022 16:06
Checks project permissions for a user, based on a list of Jira projects and a list of permissions to check for.
<?php
define("BASE", "https://<jira-api-url>");
define("CHECKFOR", array(
'EDIT_SPRINT_NAME_AND_GOAL_PERMISSION',
'MANAGE_SPRINTS_PERMISSION',
'START_STOP_SPRINTS_PERMISSION'
));
@itst
itst / spaces.php
Last active January 7, 2022 13:53
When were Confluence Spaces last modified? Use the Confluence REST API to get all Spaces and the date of the latest content change in each.
<?php
define('BASE', 'https://wiki.domain.com/rest/api/');
define('USERNAME' , 'foo');
define('PASSWORD' , 'bar');
function prepareCall(&$curl, $query) {
curl_setopt($curl, CURLOPT_URL, BASE . $query);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, USERNAME . ':' . PASSWORD);
@itst
itst / XING-vcards.scpt
Created February 20, 2019 09:12
Using Safari and DEVONagent to download your contacts' vCards off XING. Rewrite it to download with Safari or create a textfile with all the links.
tell application "Safari"
set nextPage to "https://www.xing.com/contacts/contacts"
repeat while nextPage is not "-"
open location nextPage
my waitForPageLoad()
delay (random number from 0.2 to 1.0)
my getVcardLinks()
set nextPage to my gotoNextPage()
end repeat
end tell
@itst
itst / Archive.scpt
Last active October 21, 2019 07:15
To keep my IMAP account's inbox as small as possible, I move mails into yearly archives. I usually do that once every quarter. But if I don't, well then I have many mails to move. This AppleScript does the heavy lifting.
tell application "Mail"
set _a to imap account "sc@itst.net"
set _i to _a's mailbox "INBOX"
set _ms to (messages of _i)
set numLog to 50
set iteration to 1
set iterationMax to number of _ms
log iterationMax & " msgs to move"
repeat with _m in _ms
if (iteration mod numLog is 0) then
@itst
itst / bookmarklet.js
Created March 29, 2018 08:41
Bookmarklet to open DIY Captions with current YT video
javascript:void%20function(){window.open(%22http://diycaptions.com/php/get-automatic-captions-as-txt.php%3Fid=%22+location.href.match(/(^|=|\/)([0-9A-Za-z_-]{11})(\/|%26|$|\%3F|%23)/)[2]+%22%26language=asr%22)}();
Regex from https://stackoverflow.com/questions/3452546/how-do-i-get-the-youtube-video-id-from-a-url
Hat tip to Mike Ridgway of DIYCaptions.com
@itst
itst / youtube-captions.xml
Last active February 20, 2019 08:30
XPath returning the captions embedded in a YT video page
//*[@id="body"]/ytd-transcript-body-renderer/div/div[2]/div
@itst
itst / getstuff.sh
Created March 20, 2018 22:31
Downloader for consecutively named files.
#!/bin/bash
for i in `seq 1 80`; do
r=$(( $RANDOM % 2 ))$(( $RANDOM % 10 ))$(( $RANDOM % 10 ))r=$(( $RANDOM % 10 ))
curl http://www.domain.com/$i.jpg -o $(printf '%04d' $i).jpg
sleep $(jot -r 1 0.5 2.4)
done
@itst
itst / INSTALL.md
Last active October 26, 2019 22:58
Installling ibooks-highlights on macOS 10.12

Installation

  1. Download/clone https://github.com/matttrent/ibooks-highlights
  2. pip3 install click
  3. brew install libyaml
  4. cd to cloned copy
  5. sudo python3 setup.py install
  6. copy templates from ibook_highlights/templates to /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ibooks_highlights-0.1.0-py3.6.egg
  7. Create directoy to hold your notes. mkdir ~/Documents/Annotations
  8. cd ~/Documents/Annotations
@itst
itst / Pinboard.scpt
Last active January 10, 2024 11:40
Import and regularly replicate your Pinboard bookmarks in DEVONthink.
(* Import and update your Pinboard bookmarks to DEVONthink
Based on work done by Christian Grunenberg on Mon Jan 23 2006,
Rafael Bugajewski to support Pinboard instead of Delicious on Sun Dec 19 2010 and
Andreas Zeitler on Sun Mar 03 2011 to display user feedback when finished.
By Sascha A. Carlin <https://sascha.carlin.de/> on 2018-03-07 to set the creation date of new record, show progress bar, use Pinboard Auth Token, use modification date of folder to fetch only recent items
Copyright (c) 2018. All rights reserved. *)
use framework "Foundation"

Keybase proof

I hereby claim:

  • I am itst on github.
  • I am itst (https://keybase.io/itst) on keybase.
  • I have a public key ASC96u1WOl1XFofBcnO-6fryJl1HZubUPOKXJ5FMGOI5Pwo

To claim this, I am signing this object: