Skip to content

Instantly share code, notes, and snippets.

@TheDauthi
TheDauthi / dockerhost.sh
Last active March 5, 2018 21:00
Dockerhost detection
#!/usr/bin/env sh
# The default hostname to set
DEFAULT_DOCKER_HOSTNAME=${DEFAULT_DOCKER_HOSTNAME-dockerhost.internal}
# A comma-delimited list of extra hostnames to add as aliases
EXTRA_DOCKER_HOSTNAMES=${EXTRA_DOCKER_HOSTNAMES-}
# Whether to export variables
EXPORT_DOCKERHOST=${EXPORT_DOCKERHOST-1}
@tlc
tlc / humble_bundle_file_downloader.js
Last active March 25, 2020 08:58 — forked from Woody2143/humble_bundle_file_downloader.js
Download HumbleBundle book bundles easier. Puts 'curl' statements on the page for you to copy.
/* 11/27/2017 - Tweaked for a page redesign.
* 1/6/2018 - Handle videos in book bundle.
*/
var pattern = /(MOBI|EPUB|PDF( ?\(H.\))?|CBZ)$/i;
var pattern2 = /(Download)$/;
var nodes = document.getElementsByTagName('a');
var downloadCmd = '';
for (i in nodes) {
var a = nodes[i];
if (a && a.text && pattern.test(a.text.trim())) {
@uprego
uprego / gitk multi stash patch - debian stretch
Created September 25, 2017 11:47
gitk multi stash patch - debian stretch
# pwd && echo && diff -u gitk-deb9-vanilla gitk-deb9-multistash; echo; ls -l | grep gitk
/usr/bin
--- gitk-deb9-vanilla 2017-08-09 06:49:17.000000000 +0000
+++ gitk-deb9-multistash 2017-09-25 11:30:11.386472474 +0000
@@ -296,6 +296,12 @@
set revs HEAD
} elseif {[lsearch -exact $revs --all] >= 0} {
lappend revs HEAD
+ set stashesfd [open [concat | \
@russelldavis
russelldavis / debug-in-byebug-with-redirects.rb
Last active June 3, 2019 16:42
How to debug in byebug with stdin/stdout/stderr redirected
# Before calling `byebug`, run the following:
require 'io/console'
require 'byebug'
Readline.input = IO.console
Readline.output = IO.console
Byebug::Context.interface.instance_variable_set('@input', IO.console)
Byebug::Context.interface.instance_variable_set('@output', IO.console)
Byebug::Context.interface.instance_variable_set('@error', IO.console)
# This used to be built in to byebug (https://github.com/deivid-rodriguez/byebug/pull/211)
@uprego
uprego / gitk multi stash patch - wheezy and jessie
Last active May 7, 2017 10:07
Surprisingly simple multi stash patch for gitk. Works for gitk as it comes in Debian 7 and 8. Known caveat: shows stashes even running `gitk` without the --all switch, in contrast to the standard behavior. See also an improved version at https://gist.github.com/uprego/600445d4f4633113c3ed0ff24994bbed which solves the caveat and also does not dep…
$ diff -u /usr/bin/gitk-deb8-vanilla /usr/bin/gitk-deb8-multistash
--- /usr/bin/gitk-deb8-vanilla 2016-08-29 10:07:06.507344629 +0200
+++ /usr/bin/gitk-deb8-multistash 2016-09-08 14:36:35.382476634 +0200
@@ -401,6 +401,11 @@
if {$vcanopt($view)} {
set revs [parseviewrevs $view $vrevs($view)]
+ set stashesfd [open [concat | gitk-stash-list-ids.sh] r]
+ while {[gets $stashesfd stashline] >= 0} {
+ set revs [lappend revs $stashline]
@klappradla
klappradla / debugging_in_jruby.md
Last active March 22, 2024 12:10
Debugging in JRuby

Debugging in JRuby

Step-by-step debugging and stack navigation for JRuby code.

Problem: the common tools byebug and pry-byebug are MRI-only.

Prerequisites

Force JRuby to run in fully interpreted mode:
(otherwise next would behave like step)

@apettinen
apettinen / gist:701688cc64881a1ae1c1
Last active October 18, 2018 23:37
Getting on track with Office2016 licensing

This gist gives a short outline of how to get back on track with Office 2016 licensing if you have been using the Combo Update packages available via AutoPKG to distribute Office 2016 applications and thus copying the Office license file around.

  1. download an installer package from http://macadmins.software (e.g. Word Standalone installer)

  2. extract the LauncDaemon and PrivilegedHelperTool from the installer package (e.g. by running the installer on a VM):

  • /Library/LaunchDaemons/com.microsoft.office.licensingV2.helper.plist
  • /Library/PrivilegedHelperTools/com.microsoft.office.licensingV2.helper
  1. package the abovementioned two files
@allaire
allaire / upload_erb.rb
Last active March 28, 2018 21:53
Capistrano 3 upload file from erb template
def template(from, to, options = {})
template_path = File.expand_path("../../templates/#{from}", __FILE__)
template = ERB.new(File.new(template_path).read).result(binding)
upload! StringIO.new(template), to, mode: 0644 # Otherwise it's set to 0640, which is not readable by other users (https://github.com/net-ssh/net-scp/blob/master/lib/net/scp/upload.rb#L63)
sudo "chown root:root #{to}" if options[:as_root]
end
@cheald
cheald / proposal.md
Last active January 3, 2016 18:21
rubygems-trust proposal

Root Key & Signing System

A single X509 key is generated per distribution platform (Rubygems.org, Gemfury, etc). This key is used to sign gem author requests.

A gem author may generate a certificate and request that the platform sign it. Alice generates her x509 keypair with her email address encoded as the x509 name field, stashes the private key somewhere safe, and submits the pubkey to the signing system.

The signing system consists of two parts:

  1. [Machine A] A web UI (or email inbox) responsible for accepting public keys and sending emails
  2. [Machine B] A signing machine with a shared data store (shared NFS mount, redis store, whatever - it must simply be a data store to act as a dead drop)