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
  • 19:02 (UTC -04:00)
  • X @lsloan_umich
View GitHub Profile
@cboettig
cboettig / docker-compose.yml
Last active March 8, 2025 20:25
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter
@andre1810
andre1810 / list_vagrant_port_forwardings.rb
Last active April 2, 2021 17:52
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}`
@Ema-Mu
Ema-Mu / youtube2srt.rb
Created November 2, 2015 16:03 — forked from lsloan/ Convert video subtitles from YouTube XML format to SubRip (.srt)
Convert XML Youtube subtitles to SubRip (srt)
# Convert XML Youtube subtitles to SubRip (srt) format
# To download the subtitle in XML, put de code of the Youtube video
# at the end of the next url:
# http://video.google.com/timedtext?hl=en&lang=en&v=
require 'rubygems'
require 'hpricot'
youtube_xml = ARGV[0]
xml = Hpricot.XML(open(youtube_xml))
@lsloan
lsloan / setjdk.sh
Last active February 4, 2020 15:39
setjdk() function for bash: Use "setjdk 1.7", "setjdk 1.8", or "setjdk" (to see current setting).
# Adapted from http://superuser.com/a/568016/64151
# Add this function to .bash_profile, then use
# "setjdk 1.7", "setjdk 1.8", or "setjdk" (to see current setting).
function setjdk() {
if [ $# -ne 0 ]; then
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
@joar
joar / jq-insert-var.sh
Last active March 8, 2025 21:45
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@fliedonion
fliedonion / !GIST file list order - summary.md
Last active April 20, 2025 11:29
Understand GIST file list order.
Summary How to control (or Understand) your GIST page's files list order.
Notice not official documentation.
@esironal
esironal / github.jquery.js
Last active May 25, 2019 10:39 — forked from lsloan/ List GitHub Projects Using jQuery
list-github-projects-using-javascript
// http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
jQuery.githubUserRepositories = function(username, callback) {
jQuery.getJSON("https://api.github.com/users/" + username + "/repos?callback=?", callback);
}
jQuery.fn.loadRepositores = function(username) {
this.html("<span>Querying GitHub for repositories...</span>");
var target = this;
@uupaa
uupaa / image.resize.in.github.flavored.markdown.md
Last active March 24, 2025 23:12
image resize in github flavored markdown.

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

  • ![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)
# Convert XML Youtube subtitles to SubRip (srt) format
# To download the subtitle in XML, put de code of the Youtube video
# at the end of the next url:
# http://video.google.com/timedtext?hl=en&lang=en&v=
require 'rubygems'
require 'hpricot'
youtube_xml = ARGV[0]
xml = Hpricot.XML(open(youtube_xml))
@lsloan
lsloan / List GitHub Projects Using jQuery
Last active February 6, 2020 16:06 — forked from tantalor/github.jquery.js
An example JavaScript program using jQuery to get a list of GitHub projects.
Gist title: "List GitHub Projects Using jQuery"
Summary: An example JavaScript program using jQuery to get a list of GitHub projects.
Original source: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html