Skip to content

Instantly share code, notes, and snippets.

View flooie's full-sized avatar

William Palin flooie

  • Free Law Project
  • Cambridge, MA
View GitHub Profile
@evansobkowicz
evansobkowicz / EmbedsViewController.swift
Last active September 2, 2023 18:01
EmbedsViewController Example Code
//
// EmbedsViewController.swift
//
// Created by Evan Sobkowicz.
// Copyright © 2019 Twitter. All rights reserved.
//
import UIKit
import WebKit
import SafariServices
//
// main.swift
// ImageExtractor
//
// Created by Damiaan on 13/08/2019.
// Copyright © 2019 dPro. All rights reserved.
//
import Quartz
@MichalZalecki
MichalZalecki / docx2pdf.py
Created July 8, 2017 08:09
Converting DOCX to PDF using Python
import sys
import subprocess
import re
def convert_to(folder, source, timeout=None):
args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
filename = re.search('-> (.*?) using filter', process.stdout.decode())
@Koze
Koze / TextDetection.m
Last active June 14, 2019 22:38
Text Detection with Vision Framework
- (void)detectWithImageURL:(NSURL *)URL
{
VNImageRequestHandler *handler = [[VNImageRequestHandler alloc] initWithURL:URL options:@{}];
VNDetectTextRectanglesRequest *request = [[VNDetectTextRectanglesRequest alloc] initWithCompletionHandler:^(VNRequest * _Nonnull request, NSError * _Nullable error) {
if (error) {
NSLog(@"%@", error);
}
else {
for (VNTextObservation *textObservation in request.results) {
// NSLog(@"%@", textObservation);
@vjk2005
vjk2005 / automator_jquery.txt
Created March 2, 2017 06:23
Inject jquery into the most active tab using JXA (Javascript for Automation, OSX)
// put this inside a Run Javascript block in Automator
app.doJavaScript("var script = document.createElement('script'); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js'; document.getElementsByTagName('head')[0].appendChild(script);", {
in: app.windows[0].currentTab
})
delay(1); // wait for jQuery to load
//... jQuery is now loaded, now add the rest of the script
@averagesecurityguy
averagesecurityguy / pdf_flatedecode.py
Last active April 20, 2024 17:56
Decompress FlateDecode Objects in PDF
#!/usr/bin/env python3
# This script is designed to do one thing and one thing only. It will find each
# of the FlateDecode streams in a PDF document using a regular expression,
# unzip them, and print out the unzipped data. You can do the same in any
# programming language you choose.
#
# This is NOT a generic PDF decoder, if you need a generic PDF decoder, please
# take a look at pdf-parser by Didier Stevens, which is included in Kali linux.
# https://tools.kali.org/forensics/pdf-parser.
#
@bluekvirus
bluekvirus / flask-uWSGI-nginx.md
Last active July 19, 2022 20:26
How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04+

How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04

@credit Yan Zhu (https://github.com/nina-zhu)

Introduction

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions, it can help you get your Python application or website off the ground. Flask includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server is required.

In this guide, we will demonstrate how to install and configure some components on Ubuntu 14.04 to support and serve Flask applications. We will configure the uWSGI application container server to interface with our applications. We will then set up Nginx to reverse proxy to uWSGI, giving us access to its security and performance features to serve our apps.

Prerequisites and Goals

@vees
vees / darkice-install-pi.sh
Last active February 9, 2020 20:03
Install darkice with MP3 support on Raspberry Pi
echo "deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libmp3lame-dev
apt-get source darkice
cd darkice-1.2/
./configure --prefix=/usr --sysconfdir=/usr/share/doc/darkice/examples \
--with-lame --with-lame-prefix=/usr/lib/arm-linux-gnueabihf \
--with alsa --with-alsa-prefix=/usr/lib/arm-linux-gnueabihf
make
sudo make install
@pcostesi
pcostesi / uwsgi-and-nginx.md
Last active December 28, 2019 17:38
uWSGI and NGiNX
@IanHopkinson
IanHopkinson / lxml_examples.py
Created November 24, 2015 19:42
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">