Skip to content

Instantly share code, notes, and snippets.

View benjbaron's full-sized avatar

Benjamin Baron benjbaron

View GitHub Profile
func Benchmark_append(b *testing.B) {
b.StopTimer()
b.ReportAllocs()
b.StartTimer()
for i := 0; i < 1000; i++ {
var a []int
for i := 0; i < 100000; i++ {
a = append(a, i)

IntelliJ shortcuts

Reference: https://vimeo.com/98922030

  1. Do not use tabs, deactivate them in the preference panel.
  2. Naviguate through files using CMD+E and CMD-SHIFT-E (last edited files)
  3. Highlight usages with SHIFT-CMD-F7
  4. Get rid of everything with SHIFT-CMD-F12 (full mode)
  5. Select blocks of text with ALT+UP ARROW
  6. Move blocks up and down with SHIFT+ALT+UP
package types
import (
"encoding/json"
"time"
)
// FIXME: This does not currently work with JSON's omitempty.
// See: https://github.com/golang/go/issues/11939
@benjbaron
benjbaron / redis_cheatsheet.bash
Created May 14, 2019 12:44 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@benjbaron
benjbaron / postgres_queries_and_commands.sql
Created January 15, 2021 22:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'