Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am arbelt on github.
  • I am albertw (https://keybase.io/albertw) on keybase.
  • I have a public key ASCBWZ3D7wuyMMGlT-Lz1hDrQ5BcRsuyy9kluIJ3Wiw-4wo

To claim this, I am signing this object:

@arbelt
arbelt / blah.R
Last active August 1, 2018 20:11
Cities
library(tidyverse)
library(stringi)
library(stringr)
df <- tibble::tribble(
~id, ~response,
1, "Paris to Berlin blah blah blah",
2, "Hello there stuff berlin London to Madrid berlini-Stuff Dover",
3, "Białystok to Port-au-Prince",
4, "I went to Saudi",
@arbelt
arbelt / drill-1.16-addDefaultRowPrefetch.patch
Last active July 25, 2019 20:24
Add connection parameters to JDBC connections for Drill 1.16
diff --git a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
index ebff37173..16dc163c9 100755
--- a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
+++ b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcStoragePlugin.java
@@ -90,6 +90,8 @@ public class JdbcStoragePlugin extends AbstractStoragePlugin {
source.setDriverClassName(config.getDriver());
source.setUrl(config.getUrl());
+ source.addConnectionProperty("defaultRowPrefetch", "200");
+
@arbelt
arbelt / optimus.R
Created August 21, 2019 17:12
simple R implementation of "optimus" algorithm for obfuscating numeric IDs. Original PHP implementation at https://github.com/jenssegers/optimus
## Super simple implementation of "optimus" algorithm. Easy and fast way to
## encrypt/decrypt numbers. To make it more user-friendly, the `.settings`
## function generates a prime number and mask from a supplied key string. This
## depends on a stable hash of the string, so it's probably a good idea to jot
## down the underlying numbers (prime and mask) in case something changes with
## the hash internals. You'll always be able to decrypt if you know the prime
## and mask.
library(digest)
library(gmp)
@arbelt
arbelt / open_without.sh
Created October 8, 2019 21:16 — forked from jamesrampton/open_without.sh
Clean up Mac OS X Open With menu
#!/bin/bash
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
killall Finder
@arbelt
arbelt / textreg_example.R
Created May 15, 2020 01:59
Example with textreg
library(textreg)
library(tm)
library(dplyr)
library(wrapr) # for dot-pipe
df_mi <- df0 %.>%
filter(., !is.na(mostimportant))
corp_mi <- df_mi %.>%
pull(., mostimportant) %.>%
@arbelt
arbelt / macos-tmux-256color.md
Created June 27, 2020 16:07 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS

Installing tmux-256color for macOS

macOS has ncurses version 5.7 which doesn't ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color you can use screen-256color, place this command into your ~/.tmux.conf.

set-option -g default-terminal "screen-256color"
@arbelt
arbelt / init.lua
Created October 2, 2016 20:55
Hammerspoon config to send escape on short ctrl press
ctrl_table = {
sends_escape = true,
last_mods = {}
}
control_key_timer = hs.timer.delayed.new(0.15, function()
ctrl_table["send_escape"] = false
-- log.i("timer fired")
-- control_key_timer:stop()
end