Skip to content

Instantly share code, notes, and snippets.

View lsloan's full-sized avatar

Mr. Lance E Sloan «UMich» lsloan

  • Teaching and Learning (@tl-its-umich-edu) at University of Michigan: Information and Technology Services
  • Ann Arbor, Michigan, USA
  • 17:09 (UTC -04:00)
  • X @lsloan_umich
View GitHub Profile
@lsloan
lsloan / submodulewiki.md
Created October 14, 2016 18:04 — forked from iracooke/submodulewiki.md
Wiki as a submodule

From within the parent repo do

        git submodule add git@bitbucket.org:iracooke/transcriptomes.git/wiki wiki
        git commit -m "Adding wiki as submodule"
        git push

Making changes to the wiki and to the parent require separate git commit commands.

@lsloan
lsloan / Markdown and reStructuredText: A Comparison
Last active December 13, 2016 22:26 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText
Gist title: "Markdown and reStructuredText: A Comparison"
Summary: A comparison of formatting features in Markdown and reStructuredText documents. See the " README.md" file for details.
@lsloan
lsloan / Minimal JSON-LD required for Graded vocab
Last active December 5, 2016 15:24 — forked from anonymous/README.md
JSON-LD Playground: Minimal JSON-LD required for Graded vocab
See README.md, https://gist.github.com/lsloan/2e43be50000bc13f178cad7fcfca71f0#file-readme-md
@lsloan
lsloan / README.md
Created February 21, 2017 18:02 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@lsloan
lsloan / list_vagrant_port_forwardings.rb
Last active March 22, 2017 21:16 — forked from andre1810/list_vagrant_port_forwardings.rb
List Port Forwardings of vagrant machines
vm_infos = `vboxmanage list vms`
puts 'Port Forwardings:'
puts '---------------------------------'
vm_infos.each_line do |vm_info|
vm_name = vm_info.scan(/\"(.*)\"/)
vm_id = vm_info.scan(/.*{(.*)}/).join('')
vm_detail_info = `vboxmanage showvminfo #{vm_id}`
@lsloan
lsloan / extra_functions.py
Created June 22, 2017 18:11 — forked from pythonanywhere/extra_functions.py
PythonAnywhere Gist DemoBot
import os
import subprocess
def get_google_news_homepage():
print("this will fetch the current google news home page as text.")
print("it will use the requests and lxml libaries")
print("press enter to continue")
input()
import requests
@lsloan
lsloan / Vim Notebook.md
Created July 13, 2017 15:42 — forked from sloanlance/Vim Notebook.md
vim: Notes about using the vim editor, especially useful regular expressions (regex, regexes).

Vim Notebook

Notes about using the vim editor, especially useful regular expressions (regex, regexes).

  • Run an external command on all matching lines

    :g/pattern/.!command

    It's important that the dot command (.) appear between the search pattern and the bang (!) beginning the external command.

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p
    
@lsloan
lsloan / jsonlSort.sh
Created July 13, 2017 17:47 — forked from sloanlance/jsonlSort.sh
jq, JSON: Sort JSONL by using jq's `--slurp` option to treat it as a JSON array
#!/bin/sh --
# Execute with an argument containing the name of the property to be
# used for sorting.
# Improved according to a suggestion from @pkoppstein in response to my
# support issue:
# https://github.com/stedolan/jq/issues/1447#issuecomment-314918635
jq --slurp --compact-output 'sort_by(.'${1}')[]'
@lsloan
lsloan / Depersonalize JSON.md
Created August 15, 2017 16:02 — forked from sloanlance/Depersonalize JSON.md
jq: Depersonalize JSON

Depersonalize JSON

Why

If JSON data is to be shared for analysis, it's often necessary to depersonalize the data first. Depersonalization is different than anonymization. If data is anonymized, all information about the user is removed. Depersonalization, however, changes the user information to values that can't be recognized as being related to the real user. This way, it's still possible to see relationships within the data.