Skip to content

Instantly share code, notes, and snippets.

@agsdot
agsdot / github_oauth.js
Created October 23, 2016 01:45 — forked from arb/github_oauth.js
Example hapi server using GitHub OAuth
var Hapi = require('hapi');
var Bell = require('bell');
var AuthCookie = require('hapi-auth-cookie');
var server = new Hapi.Server();
server.connection({ port: 9001 });
server.register([Bell, AuthCookie], function (err) {
if (err) {
@agsdot
agsdot / gist:1a24263835693fbd265f19e5ba1b1d1d
Created October 6, 2016 21:21 — forked from amandavisconti/gist:e909e41e6896d2a90de8
Setting up Annotator.js annotation on Drupal
Annotator.js works on Drupal as two modules and a library (installed, as usual, under /sites/all):
/modules/annotator
/modules/annotation
/libraries/annotator
The files in libraries/annotator are the latest from the Annotator.js repo (https://github.com/openannotation/annotator/releases). Although the modules Infinite Ulysses uses have been significantly changed from the modules you could download on Drupal.org, the Drupal.org Annotator (https://www.drupal.org/project/annotator) and Annotation (https://www.drupal.org/project/annotation) modules pages might still have useful info if you're troubleshooting.
Instructions:
I'll refer to the two modules as "Annotator" and "Annotation" throughout, and use "libraries/annotator" if I'm referring to the JS library.
1. Rename /libraries/annotator folder as just "annotator" and place in your sites/all/libraries folder (create a libraries folder there if you don't already have one).
@agsdot
agsdot / elixirphoenix.bash
Created September 25, 2016 21:46 — forked from likethesky/elixirphoenix.bash
Installing Elixir & the Phoenix framework with Homebrew on OS X
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez
[Unit]
Description=Start KA Lite Web Service
Addfter=network.target
[Service]
Type=simple
ExecStart=/usr/bin/kalite start
ExecStop=/usr/bin/kalite stop
RemainAfterExit=yes
Restart=always
RestartSec=30
echo "hello"
echo "today wow"
@agsdot
agsdot / ask.sh
Created August 27, 2016 05:41
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
local prompt default REPLY
while true; do
cd smile_v2/backend/assets/couchdb
curl -X PUT http://127.0.0.1:5984/smile/_design/activity --data-binary @./_design.activity.json
curl -X PUT http://127.0.0.1:5984/smile/_design/generic --data-binary @./_design.generic.json
curl -X PUT http://127.0.0.1:5984/smile/_design/group --data-binary @./_design.group.json
curl -X PUT http://127.0.0.1:5984/smile/_design/institution --data-binary @./_design.institution.json
curl -X PUT http://127.0.0.1:5984/smile/_design/resource --data-binary @./_design.resource.json
curl -X PUT http://127.0.0.1:5984/smile/_design/response --data-binary @./_design.response.json
curl -X PUT http://127.0.0.1:5984/smile/_design/session --data-binary @./_design.session.json
curl -X PUT http://127.0.0.1:5984/smile/_design/user --data-binary @./_design.user.json
@agsdot
agsdot / env.conf
Created August 7, 2016 02:22 — forked from ryenus/env.conf
/etc/systemd/system/elasticsearch.service.d/env.conf
[Service]
Environment=PATH=/opt/java/bin:/usr/local/sbin:/usr/local/bin:/usr/bin
Environment=ES_HOME=/usr/share/elasticsearch
Environment=ES_INCLUDE=/usr/share/elasticsearch/bin/elasticsearch.in.sh
@agsdot
agsdot / node-and-npm-in-30-seconds.sh
Created July 27, 2016 22:55 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@agsdot
agsdot / README.md
Created July 26, 2016 21:26 — forked from ichpuchtli/README.md
create_ap systemd service