Skip to content

Instantly share code, notes, and snippets.

@arbelt
arbelt / macos-tmux-256color.md
Created Jun 27, 2020 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS
View macos-tmux-256color.md

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
Example with textreg
View textreg_example.R
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 Oct 8, 2019 — forked from jamesrampton/open_without.sh
Clean up Mac OS X Open With menu
View open_without.sh
#!/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 Aug 21, 2019
simple R implementation of "optimus" algorithm for obfuscating numeric IDs. Original PHP implementation at https://github.com/jenssegers/optimus
View optimus.R
## 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 Jul 25, 2019
Add connection parameters to JDBC connections for Drill 1.16
View drill-1.16-addDefaultRowPrefetch.patch
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");
+
View blah.R
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",
View keybase.md

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 Oct 20, 2017
Simple script to fetch SSH keys from Github
View get_github_keys.pl
#!/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 Sep 14, 2017
fish abbreviations
View -
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'
View Merging duplicate records with different fields filled in.R
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 %>% `!`))) %>%