Skip to content

Instantly share code, notes, and snippets.

@jennybc
jennybc / 2014-10-12_stop-working-directory-insanity.md
Last active February 19, 2025 22:20
Stop the working directory insanity

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

@robmiller
robmiller / gist:214b3adf820b41a847c2
Last active August 7, 2022 18:53
Text processing tutorial: splitting files, rows to columns, line endings

For this tutorial, we have the following brief. That is: to take a file that contains many millions of lines of text, each one of them a single column — something that looks like this:

POPLKLMNE
GKITLOPOM
QASSLKOPI
== snip ==

...into multiple text files, each with a fixed number of lines in them, each with — instead of one column per line — several columns, separated with a comma. In other words, something that looks like this:

POPLKLMNE,GKITLOPOM,QASSLKOPI
__BEGIN__
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
@iGEL
iGEL / .Xresources
Last active August 31, 2020 11:26
Xft.dpi: 96
URxvt.font: xft:DejaVu\ Sans\ Mono:size=11
URxvt.scrollBar: off
URxvt.saveLines: 4096
URxvt.perl-ext-common: default,url-select,keyboard-select,font-size,clipboard
URxvt.urlLauncher: xdg-open
@miyagawa
miyagawa / circular-detect.pl
Last active November 2, 2021 15:33
Circular perl/CPAN dependencies with requires/recommends/suggests for configure/runtime/build/test for all modules in 02packages
#!/usr/bin/env perl
use strict;
use Parse::CPAN::Packages;
use Module::CoreList;
use JSON::XS;
$| = 1;
my $packages_file = "$ENV{HOME}/minicpan/modules/02packages.details.txt.gz";
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 28, 2025 15:19
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fjolnir
fjolnir / tlc.lua
Last active September 29, 2024 14:57
LuaJIT ObjC bridge
The bridge is now located at https://github.com/fjolnir/TLC
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
@withakay
withakay / bjorklund.js
Created October 14, 2011 10:10
Bjorklund algorithm in JavaScript
/*
An implementation of the Bjorklund algorithm in JavaScript
Inspired by the paper 'The Euclidean Algorithm Generates Traditional Musical Rhythms'
by Godfried Toussaint

This is a port of the original algorithm by E. Bjorklund which I
found in the paper 'The Theory of Rep-Rate Pattern Generation in the SNS Timing Systems' by
E. Bjorklund.