Skip to content

Instantly share code, notes, and snippets.

View dlo's full-sized avatar
Always shipping.

Dan Loewenherz dlo

Always shipping.
View GitHub Profile

![Meme](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABVYAAARUCAYAAAD6a9P7AAAABHNCSVQICAgIfAhkiAAAIABJREFUeJzt3XuYVdd53/Hvfe90LV1ptlSxa2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2iK2

local defaultText = "make good new things"
local defaultTextGroup = vim.api.nvim_create_augroup("DefaultTextPlugin", { clear = true })
local function centerDefaultText()
local winWidth = vim.api.nvim_win_get_width(-1)
local winHeight = vim.api.nvim_win_get_height(-1)
local gutterWidth = vim.api.nvim_win_get_option(-1, "numberwidth") or 0
local textAreaWidth = winWidth - gutterWidth
local leftPadding = math.floor((textAreaWidth - #defaultText) / 1)
@dlo
dlo / main.go
Last active February 24, 2025 21:08
A little demonstration of how to provide a filename when uploading a file to a vector store using the OpenAI Assistants API.
package main
import (
"bytes"
"context"
"io"
"github.com/openai/openai-go"
)
@dlo
dlo / handle.ts
Created December 18, 2020 23:57 — forked from destroytoday/handle.ts
/*
Typescript erroring:
---
Type 'Promise<(T | undefined)[] | [any, undefined]>' is not assignable to type 'Promise<[void | Error, void | T]>'.
Type '(T | undefined)[] | [any, undefined]' is not assignable to type '[void | Error, void | T]'.
Type '(T | undefined)[]' is not assignable to type '[void | Error, void | T]'.
Target requires 2 element(s) but source may have fewer.ts(2322)
*/
export default function <T> (promise: Promise<T>): Promise<[Error | void, T | void]> {
Verifying my Blockstack ID is secured with the address 1NBmXpzWD5qHQNR7gB7Weod1d7FhFBXeuV https://explorer.blockstack.org/address/1NBmXpzWD5qHQNR7gB7Weod1d7FhFBXeuV
<?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>
@dlo
dlo / keybase.md
Created September 18, 2018 20:00

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 / [email protected]
Last active May 23, 2018 18:50
Homebrew recipe for hadoop 2.4.1 on macOS 10.13.4
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+"
--- 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);
+ {
@dlo
dlo / mixpanel-delete-people.py
Created April 12, 2018 00:38 — forked from JorgenHookham/mixpanel-delete-people.py
Mixpanel Delete People
"""
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