Skip to content

Instantly share code, notes, and snippets.

09:01 <za1b1tsu> Is it possible to have a shared database on a common partition between 2 OSes? Because I'm trying to achieve this and I can't start the postgres service after changing the data_directory to the shared one.
09:01 <za1b1tsu> It's version 9.6.10
09:02 <RhodiumToad> 2 OSes that you are dual-booting? i.e. only one is running at a time?
09:02 --> held (~heldchen@unaffiliated/held) has joined #postgresql
09:02 <RhodiumToad> the answer is that it depends on the OSes
09:03 <peerce> if their libc implementations different significantly, it may not work.
09:03 <za1b1tsu> yes dual booting, one is Mac on is Linux, but right now I'm testing this on the VM. Sice I don't want to setup everything and then realize it doesnt work and have to start other.
09:04 <peerce> what error do you get when you try and start the 'other' OS that didn't create this ?
09:04 <za1b1tsu> the problem is the postgresql log in /var/log/... does not say much or I don't know how to interpret
09:04 <RhodiumToad> mac vs linux likely wo
06:42 <za1b1tsu> So I have a var: ['a','b']. How can I get the last element?
06:54 <flowerysong> za1b1tsu: {{ var | last }}
06:55 <flowerysong> Or {{ var[-1] }}
07:19 <za1b1tsu> but what is this syntax called {{ var | last }} etc. It is not yaml, right?
07:19 <@jborean93> it's jinja2
07:20 <@jborean93> http://jinja.pocoo.org/docs/2.10/
@bbtdev
bbtdev / ruby-read-file-from-bottom-to-top-until-match
Last active October 3, 2018 11:01
ruby read file from bottom to top until match
# thank you aperios from #ruby
#! /usr/bin/env ruby
class Rubash
def tail_match(filename, pattern)
fd = File.open(filename, 'rb')
file_byte_size = fd.size
pos = 0
result = ''
result.encode!(Encoding::BINARY)
@bbtdev
bbtdev / bash-ruby-yaml-to-json
Created September 25, 2018 09:36 — forked from chrismytton/yaml2json.sh
Shell function to convert YAML to JSON
yaml2json () {
ruby -r yaml -r json -e 'puts YAML.load($stdin.read).to_json'
}
@bbtdev
bbtdev / readline-cheatsheet.md
Last active October 15, 2018 16:45 — forked from P7h/Bash_command_line_shortcuts.md
Readline library aka command line shortcuts

Readline cheatsheet

Picked these from here

Command Editing Shortcuts

Command Note
Ctrl + a go to the start of the command line
Ctrl + e go to the end of the command line
Ctrl + k delete from cursor to the end of the command line
@bbtdev
bbtdev / deoplete option 1
Created August 17, 2018 18:56
vim-nvim-lsp-snippets-fixes
link https://github.com/autozimu/LanguageClient-neovim/issues/379
function! ExpandLspSnippet()
call UltiSnips#ExpandSnippetOrJump()
if !pumvisible() || empty(v:completed_item)
return ''
endif
" only expand Lsp if UltiSnips#ExpandSnippetOrJump not effect.
let l:value = v:completed_item['word']
- set paste automation
# ALT
same with alt + the first key stroke of your command.
Alt is a meta key that sends esc with any secondary key you press. so when I am in insert,
I'll use alt + 3, b to jump back 3 words. or alt+j, j, to go down a couple lines.
No remap needed.
!!! Some terminals require configuration
iterm Edit Profiles -> Keys -> ALT send +Esc
# CTRL
dein#recache_runtimepath()
iex -S mix test --trace test/services/load_discounts/service_test.exs:42