Skip to content

Instantly share code, notes, and snippets.

View atelic's full-sized avatar

Eric Barbour atelic

View GitHub Profile
@angelamancini
angelamancini / quiver-to-evernote.rb
Created May 20, 2017 16:14
Converts Quiver notebook exports to Evernote *.enex files. Only tested with text and code cells. This *was not tested* with any other cell types.
# Before running this script, go to Quiver and export all notebooks into json/quiver format
# Place them in a folder called `exports` in the same directory as this script.
# In terminal, run `ruby quiver-to-evernote.rb`
# Check for presence of required gems.
# If not present, install the gems
["rubygems", "sanitize"].each do |gem|
begin
gem "#{gem}"
rescue Gem::LoadError
`gem install #{gem}`
@mivade
mivade / tornadosse.py
Last active February 8, 2024 02:17
Tornado server-sent events
"""Demonstration of server-sent events with Tornado. To see the
stream, you can either point your browser to ``http://localhost:8080``
or use ``curl`` like so::
$ curl http://localhost:8080/events
"""
import signal
from tornado import web, gen
@esromneb
esromneb / email.js
Last active February 12, 2016 18:58
Name this file server/email.js and then also add that to your .gitignore
// put me at server/email.js
Meteor.startup(function () {
var user = "user";
var password = "password";
var serverAndPort = "smtp.example.com:9999";
var string = 'smtp://' + user + ':' + password + '@' + serverAndPort;
process.env.MAIL_URL = string;
});
@kconner
kconner / gist:5057423
Last active June 19, 2020 18:20
A shell tool for opening GitHub pages
## For bash or zsh:
# Opens the github page, issue, or new pull request for the current git repository in your browser
# Based on https://github.com/jasonneylon/dotfiles/
function gh {
giturl=$(git config --get remote.origin.url)
if [ "$1" = "help" ]; then
echo "gh: Opens this repository's GitHub homepage."
echo "gh 123 246: Opens the page for issues or pull requests #123 and #246."
echo "gh issues: Opens the repository's issues."
@jberger
jberger / gist:3916068
Created October 19, 2012 03:28
darabase app example
#!/usr/bin/env perl
use Mojolicious::Lite;
# connect to database
use DBI;
my $dbh = DBI->connect("dbi:SQLite:database.db","","") or die "Could not connect";
# shortcut for use in template
helper db => sub { $dbh };
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@nibrahim
nibrahim / line-length-sort.el
Created October 22, 2010 10:34
Sort lines by length
(defun sort-lines-by-length (b e)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region b e)
(let ((items (sort
(split-string
(buffer-substring (point-min) (point-max)) "[\n]")
(lambda(x y) (< (length x) (length y)))))
)