Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@gregorynicholas
gregorynicholas / jsonrpc.py
Created October 2, 2016 09:49
jsonrpc / python
#!/usr/bin/env python
# -*- coding: ascii -*-
#: see: https://github.com/dasmith/stanford-corenlp-python/blob/master/jsonrpc.py
"""
JSON-RPC (remote procedure call).
It consists of 3 (independent) parts:
- proxy/dispatcher
- data structure / serializer
- transport
@gregorynicholas
gregorynicholas / submit.md
Created January 28, 2018 09:44 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@gregorynicholas
gregorynicholas / .inputrc
Last active April 19, 2024 04:10
OSX .inputrc to make terminal way better. and by better i mean i'm naked
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
#!/usr/bin/env bash
#
# see: https://gist.github.com/gregorynicholas/2160046ec6946a2ce0fa
# src: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# updated: 2015-06-06
#
# ask for the administrator password upfront
sudo -v
@gregorynicholas
gregorynicholas / Suppress similar color.py
Created November 14, 2017 18:49 — forked from ruimac/Suppress similar color.py
Cinema 4D python script - Suppress similar color
# Script by RuiMac - 09-2015
import c4d
from c4d import gui
#Welcome to the world of Python
def replace(obj,m1,m2):
# while there are still objects...
while obj:
# get all the tags of the object
@gregorynicholas
gregorynicholas / google-apps-script-github-burndown.js
Created February 14, 2014 20:43
google apps script to create a github issues burndown chart
/**
* Heads to github fetches milestone info, and adds rows to spreadsheet
*/
function updateBugCounts() {
var resp = UrlFetchApp.fetch("https://api.github.com/repos/DramaFever/www/milestones?access_token=XXX");
var jsonStr = resp.getContentText();
var milestones = Utilities.jsonParse(jsonStr);
var dataSs = SpreadsheetApp.openById("YYY");
var sheet = dataSs.getSheetByName('Raw Data');
@gregorynicholas
gregorynicholas / email-spreadsheet-as-pdf-invoice.js
Last active April 14, 2023 22:18
google apps script to email a spreadsheet as a pdf invoice
/** Returns a PDF object based on the contents of the 'invoicing' sheet */
function invoiceToPDF(invDetails)
{
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
ssID = spreadsheet.getId();
var sheet = spreadsheet.getSheetByName(INVOICES_SHEETNAME);
var gid = sheet.getSheetId();
// &gid=x at the end of above url if you only want a particular sheet
var url2 = "http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=" + ssID +
@gregorynicholas
gregorynicholas / GScript - UAC
Created February 2, 2018 21:21
A giant list of administrator commands for a GraalOnline server -- pretty much everything you need.
/*
Emera's UAC (Universal Admin Commands)
Version 1.3
*/
function onCreated() {
this.admins = {
"Graal808129", //Emera
"Person1",
"Person2"
@gregorynicholas
gregorynicholas / pprint_doc
Created February 7, 2013 02:09
Pretty prints a mongoengine.Document.
def pprint_doc(doc, level=1):
'''Pretty prints a `mongoengine.Document`.'''
body = ['<', type(doc).__name__, ':']
# for field in sorted(doc._fields, key=lambda f: f.number):
for key, field in doc._fields.iteritems():
value = doc[key]
if value is not None:
body.append('\n%s%s: %s' % (' '.join([' ' for idx in range(level)]), key, repr(value)))
body.append('>')
@gregorynicholas
gregorynicholas / setup_apcmini.py
Created November 14, 2017 18:44 — forked from asus4/setup_apcmini.py
Setup AKAI APC mini button colors without Ableton Live
#!/usr/bin/env python
# coding: UTF-8
'''
Setup apc mini colors without Ablton Live
----------
> brew install portmidi