Skip to content

Instantly share code, notes, and snippets.

@HyShai
HyShai / # chirp - 2019-01-13_00-42-15.txt
Created January 13, 2019 05:48
chirp (tdsmith/ham/chirp) on macOS 10.14 - Homebrew build logs
Homebrew build logs for tdsmith/ham/chirp on macOS 10.14
Build date: 2019-01-13 00:42:15
http://192.168.2.129:2900
#!/usr/bin/python
import datetime
import json
import urllib2
import re
import pytz
# django utilites for parsing datetime
class FixedOffset(datetime.tzinfo):
"""
@HyShai
HyShai / Open iterm tab here
Last active September 17, 2015 15:31 — forked from gAmUssA/Open iterm tab here
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder.To use:(1) Open Automator(2) Create a new service(3) Change "Service receives selected" drop downs to "Files or folders" in "Finder"(4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
-- Modified to work with iTerm 2 night builds https://iterm2.com/applescript.html
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
var Agent = {};
Agent.check = function() {
var events = JSON.parse(this.memory('events') || '[]');
this.log('memory is: (' + typeof events + '):' + JSON.stringify(events));
var len = events.length;
var tags = (this.options('tags') || '').split(',');
var count = parseInt(this.options('count'), 10) || tags.length;
var delimeter = this.options('delimeter') || ',';
var tagPrefix = this.options('tagPrefix') || this.options('tagprefix') || '';
if (len === 0) {
Oauth2 Scope:
https://www.googleapis.com/auth/googlevoice
+https://www.googleapis.com/auth/contacts
+https://www.googleapis.com/auth/userinfo.email
+https://www.googleapis.com/auth/userinfo.profile
+https://www.googleapis.com/auth/googletalk
++++ Folder/Label counts
POST /rpc?prettyprint=false HTTP/1.1
Host: www.googleapis.com
@HyShai
HyShai / my_es6_trello_dev_challenge.js
Last active August 29, 2015 14:15
Solve the Trello dev challenge (https://trello.com/jobs/developer) recursively using ES6 features.
function unhash(hash, str="") { //default parameter values currently only supported by Firefox
var base = 7;
var multiplier = 37;
var letters = "acdegilmnoprstuw";
var index = hash % multiplier;
str = letters[index] + str;
hash = Math.trunc(hash / multiplier);
//Math.trunc is a dumb Math.floor - splits by the decimal point
//so works for negative numbers also
//(obviously doesn't make a difference here,
@HyShai
HyShai / Library-Detector.js
Last active August 29, 2015 14:12
A bookmarklet to show which Javascript libraries are running on a webpage.
//full credit for this to https://github.com/andrewbredow using his Library-Detector-for-Chrome
(function() {
function callback() {
var tests = d41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests;
var libraries = [];
for (var i in tests) {
try {
var result = tests[i].test(window);
if (result === false) continue;
libraries.push({
@HyShai
HyShai / newline-br.js
Last active March 2, 2017 17:35
convert new lines to <br/> tags for rendering
//helpers/newline-br.js
import Ember from 'ember';
export function newlineBr(text) {
var breakTag = '<br />';
return new Ember.Handlebars.SafeString((text + '')
.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'));
}
export default Ember.Handlebars.helper('newLineBr',newlineBr);
@HyShai
HyShai / pdf_split.sh
Last active August 29, 2015 14:10
Split pdf into multiple files
#!/usr/bin/sh
page_count=`pdfinfo $1 | grep Pages: | cut -d':' -f2 | tr -d ' '`
pages_per=10
i=1
while [[ $i -le $page_count ]]; do
echo $(( $i + 10 ))
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=$i -dLastPage=$(( $i + $pages_per )) -sOutputFile=output2$i.pdf $1
i=$(( $i + $pages_per ))
done