Skip to content

Instantly share code, notes, and snippets.

View retrography's full-sized avatar

Mahmood S. Zargar retrography

  • VU Amsterdam
  • Amsterdam, Netherlands
  • X @mszargar
View GitHub Profile
@Samathy
Samathy / dumppdfcomments.py
Created January 5, 2018 18:50
Python Script to extract highlighted text from PDFs. Uses python-poppler-qt4. Updated [1] to Python 3 [1] https://stackoverflow.com/questions/21050551/extracting-text-from-higlighted-text-using-poppler-qt4-python-poppler-qt4
import popplerqt4
import sys
import PyQt4
def main():
doc = popplerqt4.Poppler.Document.load(sys.argv[1])
total_annotations = 0
for i in range(doc.numPages()):
@mdo
mdo / 00-intro.md
Last active June 25, 2024 18:16
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@zlbruce
zlbruce / svg2icns
Created October 1, 2016 01:17
covert svg to icns (with imagemagick)
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"
@jcupitt
jcupitt / smartcrop.py
Last active November 1, 2022 01:30
smartcrop with Vips and Python
#!/usr/bin/python
# smartcrop with libvips, based very roughly on
# https://github.com/jwagner/smartcrop.js
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
@jcupitt
jcupitt / dominant-lab.py
Last active February 15, 2023 16:14
find dominant colour in an 8-bit RGB Image with libvips python
#!/usr/bin/python
import sys
from gi.repository import Vips
N_BINS = 10
BIN_SIZE = 256 / N_BINS
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)
@chrisallick
chrisallick / uploadS3iOS.m
Created January 3, 2014 00:43
This will upload an image to s3 from ios using the amazon library
//#import <AWSS3/AWSS3.h>
//#import <AWSRuntime/AWSRuntime.h>
//import those in your .h file and
//add the awss3 and awsruntime framework from the client
//download from Amazon
AmazonS3Client *s3Client = [[AmazonS3Client alloc] initWithAccessKey:@"Key_Goes_here" withSecretKey:@"Secret_Goes_Here"];
NSString *imageName = [NSString stringWithFormat:@"%@.png", @"cpa"];
import java.util.LinkedList;
public class LevenshteinDistance {
public static final int NONE = 0;
public static final int DELETE = 1;
public static final int INSERT = 2;
public static final int CHANGE = 3;
private static int minimum(int a, int b, int c) {
@danlucraft
danlucraft / extract.rb
Last active August 26, 2022 17:20
Extract annotations from PDFs with pdf-reader gem
require 'pdf-reader'
require './markup_receiver'
doc = PDF::Reader.new(ARGV[0])
$objects = doc.objects
def is_note?(object)
object[:Type] == :Annot && [:Text, :FreeText].include?(object[:Subtype])
end
@mocobeta
mocobeta / QueryTest.java
Last active June 10, 2016 21:57
Lucene 4.1 querying sample
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect