Skip to content

Instantly share code, notes, and snippets.

View bruno-'s full-sized avatar
♦️
Async Ruby enthusiast

Bruno Sutic bruno-

♦️
Async Ruby enthusiast
View GitHub Profile
@bruno-
bruno- / async.rb
Created November 5, 2021 21:11
Threads vs Async Ruby
require "async"
CONCURRENCY = 1000
ITERATIONS = 100
def work
Async do |task|
CONCURRENCY.times do
task.async do
sleep 1

Rubocop

Installation & usage

$ gem install rubocop

  • usage $ rubocop #=> bunch of errors (1000's maybe)
Vim Development
===============
Vim source code repository is on hosted on Github:
https://github.com/vim/vim
Apart from Github, development also happens on the vim-dev maillist with people
contributing patches via email. Subscribe if you want to get involved, see
[here](maillist.php#vim-dev).
@bruno-
bruno- / 1.exp
Last active August 29, 2015 14:14
The venerable "expect" - scripts
#!/usr/bin/expect
# start ssh process
spawn ssh root@expect
# expect this string on the screen
expect "password"
# type this to the screen
send "foobar123\r"
@bruno-
bruno- / gist:171bd1a70b5a6a574ddc
Created November 28, 2014 14:24
basic_tmux_conf_with_plugins.txt
# https://github.com/tmux-plugins/tpm
# install TPM:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-sessionist \
'
set -g @almost-sensible 'on'
@bruno-
bruno- / gist:2197a0a8e29233174380
Created November 28, 2014 14:22
basic_tmux_conf.txt
# source tmux.conf
bind R source-file ~/.tmux.conf
# tmux defaults: prefix + arrow
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# tmux defaults:
@bruno-
bruno- / example_1.rb
Last active August 29, 2015 14:08
Arel Examples
#--------------
# Basic Example
#--------------
require "./models"
name_variable = "Bill Smith"
# ActiveRecord
puts Customer.where(name: name_variable)
@bruno-
bruno- / postgres_fdw_with_active_record.rb
Last active March 12, 2020 11:22
Demo of PostgreSQL FDW wrapping a CSV file + ActiveRecord
# This is a demo of creating a Postgres FDW (foreign database wrapper)
# that encapsulates a CSV file.
# A CSV file can be manually updated and the PG table data will update too.
# Required steps in PostgreSQL
#
# 1. create a new database
# CREATE DATABASE foobar;
#
@bruno-
bruno- / standalone_active_record.rb
Last active August 29, 2015 14:06
Using standalone ActiveRecord is really easy
require "active_record"
require "pg"
# AR connection
ActiveRecord::Base.establish_connection(
adapter: "postgresql",
database: "lynda_test",
username: "<db_username>",
password: "<db_password>",
host: "localhost",
@bruno-
bruno- / gist:eddd6298deaa4940c52c
Created August 13, 2014 19:05
signing git commits - cheat sheet

Article: http://mikegerwitz.com/papers/git-horror-story

Theory

  • faking other user's commits is easy with --author flag $ git commit --author='Foo Bar <foo@bar.com>' -m 'some commit'

  • signing commits ensures:

    • someone else can't commit as myself
  • I really commited all the commits I sign