Skip to content

Instantly share code, notes, and snippets.

View olsnacky's full-sized avatar

David Poxon olsnacky

  • Brisbane, Australia
View GitHub Profile
@olsnacky
olsnacky / external-request.ts
Last active December 31, 2020 23:40
A TypeScript snippet for making external authenticated web API calls in Electron
import electron from 'electron';
function performExternalRequest() {
const cookieJar = electron.remote.session.defaultSession.cookies;
const cookie = {
url: 'https://youdomain.com',
name: 'your-cookie-name',
value: 'your-cookie-value'
};
@olsnacky
olsnacky / imagus-image-upload.py
Created December 21, 2015 23:15
Working code example of uploading an image to the Imagus Web API
import urllib, urllib2, json, cookielib, os, sys
try:
import requests
except:
print 'Please install the requests module (pip install requests)'
sys.exit()
# supress unverified warning from requests
requests.packages.urllib3.disable_warnings()
@olsnacky
olsnacky / imagus-api-example.py
Last active December 21, 2015 22:52
Working code example of working with Imagus facial recognition API
import urllib, urllib2, json, cookielib
# the api's base url
BASE_URL = 'https://api.imagus.com.au/api/v1/'
# our credentials
USER_ID = 'xxxxx'
USER_PASSWORD = 'xxxxx'
# get the various login urls
@olsnacky
olsnacky / datalog-vagrantfile
Created November 2, 2015 04:04
A Vagrantfile for a machine with Datalog.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "puppetlabs/centos-7.0-64-nocm"
config.vm.provision "shell", inline: <<-SHELL
wget http://internode.dl.sourceforge.net/project/datalog/datalog/2.5/datalog-2.5.tar.gz
sudo tar -zxf datalog-2.5.tar.gz
pushd datalog-2.5