Skip to content

Instantly share code, notes, and snippets.

View poltak's full-sized avatar

Jonathan Poltak Samosir poltak

  • WorldBrain.io - Collective Web Intelligence
  • Hoi An, Vietnam
View GitHub Profile
@poltak
poltak / tmux.md
Last active January 3, 2016 11:59 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

I'm going to assume that C-f is your prefix.

@poltak
poltak / poltakmacros.sty
Last active August 29, 2015 14:01
Personal LaTeX Macros
\ProvidesPackage{poltakmacros}
\RequirePackage[utf8]{inputenc} % Used for correct fromatting of unicode symbol § in output.
% Personal macros.
\newcommand{\vs}[2]{#1 \emph{vs.}\ #2}
\newcommand{\etal}{\emph{et al.}\ }
\newcommand{\ie}{\emph{i.e.}\ }
\newcommand{\eg}{\emph{e.g.}\ }
\newcommand{\sectref}[1]{§\ref{#1}}
\newcommand{\figref}[1]{Figure~\ref{#1}}

OS X Preferences


#Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

#Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

Lethe's project

Afuya

afuya.com.tw

  • her other company is laipha

  • essential oils and other face stuff

  • languages:

  • Chinese

function myFunction() {
// Constants
var SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/1T_Wijb2dFYmjEL3yWSETw2yJAvHE04uzDrDLjstVp4Q/edit';
var DATE_COLUMNS = {
CHECK_IN: 5,
CHECK_OUT: 6,
};
// Set up initial objects
var ss = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
@poltak
poltak / cVimrc
Last active December 23, 2016 13:43
set noscalehints
set noignorecase
const mapHistToStorageModel = async transformFn => {
const histItems = await browser.history.search({ text: '', maxResults: 9999999, startTime: 0 })
const urls = new Set()
const storageItems = []
histItems.forEach(item => {
if (urls.has(item.url)) return
urls.add(item.url)
storageItems.push(transformFn(item))
})
return storageItems
@poltak
poltak / results.txt
Created August 22, 2017 03:27
Timer results for pre-imports with indexing (5000 pages)
10:13:37.618 visits time: chunk #1: 275.9130859375ms
10:13:37.619 vists for chunk #1: 7501
10:14:39.488 add-to-index time: chunk #1: 61867.76318359375ms
10:14:39.661 visits time: chunk #2: 172.335693359375ms
10:14:39.662 vists for chunk #2: 1646
10:14:55.930 add-to-index time: chunk #2: 16266.155029296875ms
10:14:56.081 visits time: chunk #3: 150.328125ms
10:14:56.083 vists for chunk #3: 407
10:15:03.552 add-to-index time: chunk #3: 7468.192138671875ms
10:15:03.796 visits time: chunk #4: 243ms
@poltak
poltak / imports-with-indexing.txt
Created August 23, 2017 11:36
Ran imports with new indexing-enabled for a while today. These are the # of history items imported recorded every 10 mins
Time > # imports imported + indexed
=====================
12:50 > 0
13:00 > 20
13:10 > 80
13:20 > 87
13:30 > 115
13:40 > 120
13:50 > 194
14:00 > 247
// Here's an example of a doc which would be indexed in our program; all fields will be defined (arrays may be empty)
// Note the `id`, `visits`, and `bookmarks` fields contain IDs taken from our PouchDB DB, that's why they look a bit funny.
// The main thing to note about them is the second part is an epoch timestamp (in general: `:type/:timestamp/:nonce`).
// PouchDB/CouchDB indexes docs via IDs, hence it's common to derive them from some meaningful data too afford log-time lookups without much effort.
const exampleDoc = {
id: 'page/1504617273751/8255568509', // `_id` of a "PouchDB" doc from which the main `content` field is derived from
content: 'Lots and lots of text, taken from `document.innerHTML` of webpages, with some HTML and text preprocessing done in attempt to slim it down a bit',
url: 'gitter.im/fergiemcdowall/search-index', // protocol and 'www.' preprocessed out, to afford weighted query predicate on `domain.tld` patterns
visits: ['visit/1504617273700/5363014742', 'visit/1504617273700/5