Skip to content

Instantly share code, notes, and snippets.

Avatar

David Poxon olsnacky

  • Brisbane, Australia
View GitHub Profile
@olsnacky
olsnacky / external-request.ts
Last active Dec 31, 2020
A TypeScript snippet for making external authenticated web API calls in Electron
View external-request.ts
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 Dec 21, 2015
Working code example of uploading an image to the Imagus Web API
View imagus-image-upload.py
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 Dec 21, 2015
Working code example of working with Imagus facial recognition API
View imagus-api-example.py
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 Nov 2, 2015
A Vagrantfile for a machine with Datalog.
View datalog-vagrantfile
# -*- 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