Skip to content

Instantly share code, notes, and snippets.

@pjdietz
pjdietz / ContainsElements.java
Created July 22, 2015 15:24
ArgumentMatcher for checking if two collection contains the same elements.
class ContainsElements<T> extends ArgumentMatcher<Collection> {
private Collection<T> expected;
public ContainsEqualElements(Collection<T> expected) {
this.expected = expected;
}
public boolean matches(Object list) {
if (list instanceof Collection) {
Collection<T> actual = (Collection<T>) list;
return actual.size() == expected.size() && actual.containsAll(expected) && expected.containsAll(actual);
}
@stevepowell99
stevepowell99 / extractAnnotations.py
Last active December 20, 2021 21:03
Extracts annotations and highlighted passages in all .pdf files in a folder recursively and outputs them as text files with the same name and modification date
#!/usr/bin/env python
# see http://socialdatablog.com/extract-pdf-annotations.html
myxkfolder="/home/steve/xk/" #you need to set this to where you want your to-dos to appear
import poppler, os.path, os, time, datetime
for root, dirs, files in os.walk('./'):
for lpath in files:
@jexp
jexp / twitter_to_neo.rb
Last active August 29, 2015 14:04
Simple Ruby script to pull tweets from Twitter into Neo4j using Cypher
BEARER='...'
def load_tweets(query,since_id=nil,lang="en",page=1,rpp=100)
res=RestClient.get('https://api.twitter.com/1.1/search/tweets.json',
{:params=> {:q=>query, :lang=>lang,:count=>rpp,:result_type=>:recent,:since_id=>since_id},
:accept=>:json,
:Authorization => "Bearer #{BEARER}"})
puts "query '#{query}'\n since id #{since_id} result #{res.code}"
return [] unless res.code==200
data=JSON.parse(res.to_str)
@puentesarrin
puentesarrin / week_1.txt
Last active August 29, 2015 14:02
M101J Week 1 & 2 Video List
M101J Week 1 Video List
https://www.youtube.com/watch?feature=player_embedded&v=FN10crzDOjk
https://www.youtube.com/watch?feature=player_embedded&v=ysg0vfgg6fI
https://www.youtube.com/watch?feature=player_embedded&v=q2iLKZ1LgjI
https://www.youtube.com/watch?feature=player_embedded&v=CAR42sMkXEo
https://www.youtube.com/watch?feature=player_embedded&v=-KIC1LXxcGM
https://www.youtube.com/watch?feature=player_embedded&v=IAvnMgvHuLw
https://www.youtube.com/watch?feature=player_embedded&v=swhH4q_2Ttc
https://www.youtube.com/watch?feature=player_embedded&v=f-lyGAMnNY4
@untergrundbiber
untergrundbiber / oauth.sh
Last active February 3, 2022 20:49
YouTube OAuth Bash
#!/bin/bash
#YouTube OAuth authentication for shell-based YT-tools like youtube-dl
#by untergrundbiber 2014
#You need to register a app to obtaining clientId and clientSecret.
#https://developers.google.com/youtube/registering_an_application
#You can find the right scope here: https://developers.google.com/oauthplayground/
#--- Settings ---
clientId="000000000000.apps.googleusercontent.com"
@Qu4tro
Qu4tro / add2ytpl.py
Created March 30, 2014 15:31
Add youtube videos(from file or as an argument)
import httplib2
import os
import sys
from apiclient.discovery import build
# from apiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run
@eimajtrebor
eimajtrebor / darktable-workflow.md
Last active September 16, 2024 05:20
My Darktable Workflow

My Darktable Workflow

Basic workflow

  • Copy a film roll (a directory of RAW images) into a directory on the machine running Darktable.
  • Import the film roll into Darktable.
  • Review the images using lighttable mode and remove any images that are beyond repair.
  • Take a snapshot of the image so we can do a before and after comparison.
  • Adjust the white balance.
  • Exposure compensation and recovery.
{
"status": "success",
"code": 0,
"message": "ok",
"data": {
"last_name": "Alba",
"domain_verified": false,
"following_count": 71,
"image_medium_url": "http://media-cache-ec0.pinimg.com/avatars/jessicamalba_1360689715_75.jpg",
"implicitly_followed_by_me": false,
@inkhorn
inkhorn / enron corpus processing v2.py
Created November 5, 2013 03:21
Enron Corpus Processing, version 2
docs = []
from os import listdir, chdir
import re
# Here's the section where I try to filter useless stuff out.
# Notice near the end all of the regex patterns where I've called
# "re.DOTALL". This is pretty key here. What it means is that the
# .+ I have referenced within the regex pattern should be able to
# pick up alphanumeric characters, in addition to newline characters
@lrvick
lrvick / angular-socket.js
Created October 18, 2013 15:53
AngularJS service to connect to a websocket server (SockJS or pure WebSocket), manage reconnection, and allow the rest of the angular application to easily send/retrieve data from an open socket.
//TODO: make this a module
/**
* # SockJS socket management service
*
* Creates SockJS socket connection to server, re-connects on disconnection,
* and exports hooks to map handlers for various data interactions.
*
*/
angular.module('app').factory