Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name cal_anchors
// @version 1
// @grant none
// @include http://cal.huc.edu/*
// ==/UserScript==
const queryString = window.location.search;
@dimidd
dimidd / my_first_cell_in_ipynb.py
Created October 8, 2020 03:51 — forked from DalyaG/my_first_cell_in_ipynb.py
Copy paste this to your first cell in Jupyter Notebook to have wide cells, wide outputs, and inline plots.
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:95% !important; }</style>"))
display(HTML("<style>.output_result { max-width:90% !important; }</style>"))
import numpy as np
np.set_printoptions(precision=3)
np.set_printoptions(linewidth=170)
np.set_printoptions(suppress=True)
np.random.seed(42)
import nbformat
import functools
import sys
def get_key(obj, key):
if isinstance(obj, dict):
return obj.get(key, None)
elif isinstance(obj, (list, tuple)) and key < len(obj):
return obj[key]
@dimidd
dimidd / download.hs
Last active August 7, 2018 17:58
download hs
#!/usr/bin/env stack
-- stack --resolver lts-12.0 script
import Network.HTTP.Simple (parseRequest, httpLbs, getResponseBody)
import qualified Data.ByteString.Lazy as BL (writeFile)
import System.Environment (getArgs)
import Data.Foldable (for_, traverse_)
import Control.Concurrent.Async
-- Get the following program working to download the 4 URLs and save
-- their contents in the given files.
{
"dataset_reader": {
"type": "conll2003",
"tag_label": "ner",
"token_indexers": {
"tokens": {
"type": "single_id",
"lowercase_tokens": true
},
"token_characters": {
import re
import spacy
def annotate(xml):
# xml matches the pattern above
if xml[1] == "/":
return xml[2:-1] + "-end"
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
#!/usr/bin/env ruby
require "bundler/setup"
require "shoryuken/cli"
environment_path = File.expand_path("config/environment.rb")
require environment_path if File.exist?(environment_path)
Rails.application.eager_load! if defined?(Rails)
@dimidd
dimidd / dump_fixtures.rake
Last active November 24, 2016 19:50 — forked from ivanilves/dump_fixtures.rake
Dump fixtures from the current environment's database
# Source: http://blog.ivanilves.com/2016/rails-dump-fixtures-from-db/
# Usage:
# * rake db:fixtures:dump to dump all models.
# * rake db:fixtures:dump MODELS="user billing_account" to dump only User and BillingAccount models.
#
namespace :db do
namespace :fixtures do
module Main where
import Syntax
import Parser
import Eval
import Pretty
import Counter
import Control.Monad
import Control.Monad.Trans