Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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",

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 / get_github_keys.pl
Last active October 20, 2017 15:34
Simple script to fetch SSH keys from Github
#!/usr/bin/env perl
use v5.20;
use autodie;
#use HTTP::Tiny;
#my $agent = HTTP::Tiny->new(
#default_headers => { 'Accept' => 'application/json' }
#);
@arbelt
arbelt / -
Last active September 14, 2017 20:44
fish abbreviations
abbr R 'R --no-save'
abbr gst 'git status'
abbr gd 'git diff'
abbr ga 'git add'
abbr gc 'git commit'
abbr gdc 'git diff --cached'
abbr gcm 'git commit -m'
abbr gdt 'git difftool --extcmd icdiff'
abbr gl 'git pull'
abbr gco 'git checkout'
library(tidyverse, purrr)
df <- tribble(~a, ~b, ~c, ~d,
1, 2, NA, 1,
1, 2, 3, NA,
2, 2, 1, 1,
2, 2, 1, 2)
keys_to_merge <- df %>% group_by(a,b) %>%
summarise_each(funs(sum(unique(.) %>% is.na %>% `!`))) %>%