Skip to content

Instantly share code, notes, and snippets.

⚡️
Always shipping.

Dan Loewenherz dlo

⚡️
Always shipping.
Block or report user

Report or block dlo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:f41d3a579d7603814d904362d643766e
Verifying my Blockstack ID is secured with the address 1NBmXpzWD5qHQNR7gB7Weod1d7FhFBXeuV https://explorer.blockstack.org/address/1NBmXpzWD5qHQNR7gB7Weod1d7FhFBXeuV
View shortcut.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WFWorkflowClientVersion</key>
<string>700</string>
<key>WFWorkflowClientRelease</key>
<string>2.0</string>
<key>WFWorkflowIcon</key>
<dict>
View keybase.md

Keybase proof

I hereby claim:

  • I am dlo on github.
  • I am dloewenherz (https://keybase.io/dloewenherz) on keybase.
  • I have a public key ASAQ6PnT0vImLLmN24l6auaXYb-YbpB0BO2wIEjoHe1s9wo

To claim this, I am signing this object:

@dlo
dlo / hadoop@2.4.rb
Last active May 23, 2018
Homebrew recipe for hadoop 2.4.1 on macOS 10.13.4
View hadoop@2.4.rb
class HadoopAT24 < Formula
desc "Framework for distributed processing of large data sets"
homepage "https://hadoop.apache.org/"
url "https://archive.apache.org/dist/hadoop/common/hadoop-2.4.1/hadoop-2.4.1-src.tar.gz"
sha256 "09f897738e9d34bceb7e7d4494bbc75e363fb32993f56dc5a6de8aab3419b990"
env :std
bottle :unneeded
depends_on :java => "1.8+"
View JniBasedUnixGroupsNetgroupMapping.c.patch
--- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
@@ -73,7 +73,10 @@
// was successful or not (as long as it was called we need to call
// endnetgrent)
setnetgrentCalledFlag = 1;
-#ifndef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__MACH__)
+ setnetgrent(cgroup);
+ {
View mixpanel-delete-people.py
"""
This is from mixpanel customer service, I just PEP8ified it. Update api key, secret and token.
You can define which users you want to delete on line 125. Right now it will delete users who haven't
been seen in over 7 weeks. You will recieve a confirmation prompt before the people are deleted.
"""
import hashlib
import time
import urllib
import base64
@dlo
dlo / userscript.js
Created Feb 19, 2018
Fluid.app GitHub badge icon with # of open issues
View userscript.js
const $$ = (selector) => document.querySelectorAll(selector)
let items = $$("nav.reponav span.Counter");
if (items.length > 0) {
window.fluid.dockBadge = items[0].innerText;
} else {
window.fluid.dockBadge = "";
}
View better-ssh-authorized-keys-management.md

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@dlo
dlo / youtube_xml_to_srt.py
Last active Jan 25, 2018
YouTube XML Caption Format to SRT
View youtube_xml_to_srt.py
#!/usr/bin/env python3
# -*- encoding:utf-8 -*-
# Install: pip install lxml
# Usage: python youtube_xml_to_srt.py INPUT_FILE.xml > OUTPUT_FILE.srt
import re
import sys
from decimal import Decimal
import html
View upvote_comments_with_salaries.js
var r1 = /(\$|£|€)\d+(k|K)/m
var r2 = /\d+-\d+(k|K)/m
var r3 = /\d+(k|K)\s?(€|EUR)/m
var candidates = [r1, r2, r3];
var linkQueue = []
var comments = document.getElementsByTagName("tr")
for (var i in comments) {
var comment = comments[i];
if (comment.className && comment.className.indexOf("athing comtr") != -1) {
You can’t perform that action at this time.