Skip to content

Instantly share code, notes, and snippets.

@aaronmyatt
aaronmyatt / router-to-directive.js
Last active November 19, 2015 02:08
Combining ui-router with directives
//Combining ui-router with directives to make beautiful, dynamic, controller-less apps
//Taken from here: http://stackoverflow.com/a/32875215/4993527
$stateProvider.state('general', {
url: '/general',
views: {
main: {
template: '<general-directive></general-directive>'
}
}
# wrap file in square brackets and output to new file
gawk '{ print "["$0"]" }' inputfile > outputfile
@aaronmyatt
aaronmyatt / gist:c17a84d4d27075764832
Created November 19, 2015 02:07
postgres to json
# output to /tmp due to file permissions, but you could write to any file if you're running locally.
\copy (SELECT row_to_json(t) FROM (SELECT * FROM partner_stockrecord) t) to /tmp/partner_stockrecord.json
@aaronmyatt
aaronmyatt / ansible-ionic.yml
Created February 17, 2016 07:32
Ansible meets Vagrant meets Ionic
---
-
hosts: ionic-vagrant
name: "Ionic meets vagrant"
roles:
- martinmicunda.common
- martinmicunda.nodejs
- martinmicunda.ionic
- williamyeh.oracle-java
- nickp666.android-sdk
@aaronmyatt
aaronmyatt / nix_setup.sh
Created February 17, 2016 08:33
Fleshing out some (personally) desirable dev machine setup
#!/usr/bin/env bash
# Initialize a new OS with my preferred defaults
command_exists() {
type "$1" &> /dev/null ;
}
# Anything we download can be dropped and installed from here without fear
cd /tmp
#Tested on Ubuntu/trusty64
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libgl1-mesa-dev:i386
sudo apt-get install openjdk-7-jdk
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz ~/
tar zxvf ~/android-sdk-linux
@aaronmyatt
aaronmyatt / post-save-hook.py
Created October 6, 2016 14:24 — forked from jbwhit/post-save-hook.py
Saves Jupyter Notebooks as .py and .html files automatically. Add to the ipython_notebook_config.py file of your associated profile.
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py and .html files."""
if model['type'] != 'notebook':
return # only do this for notebooks
d, fname = os.path.split(os_path)
check_call(['ipython', 'nbconvert', '--to', 'script', fname], cwd=d)
check_call(['ipython', 'nbconvert', '--to', 'html', fname], cwd=d)
@aaronmyatt
aaronmyatt / gist:3184c1e2d911224d050ec95fe24dd51c
Created October 27, 2017 05:56 — forked from lukecyca/gist:907c4a62758c068fd464
Impersonating a user with the JIRA API
"""
Example of making a request to JIRA as a trusted application.
In this example, we create a new issue as an arbitrary user.
More information on this technique at:
https://answers.atlassian.com/questions/247528/how-do-you-impersonate-a-user-with-jira-oauth
"""
import oauth2
import time
@aaronmyatt
aaronmyatt / google_login.py
Last active October 27, 2017 08:20 — forked from ikegami-yukino/google_login.py
Automatically Google login by selenium
mail_address = ''
password = ''
from selenium import webdriver
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0'
PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA}
driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG)
url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/'
@aaronmyatt
aaronmyatt / cloudSettings
Last active October 3, 2018 16:20
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-10-03T16:20:18.770Z","extensionVersion":"v3.1.2"}