Skip to content

Instantly share code, notes, and snippets.

View edgar's full-sized avatar

Edgar Gonzalez edgar

View GitHub Profile
@edgar
edgar / gist:7be8459b8e281464ae06faec15227f28
Last active February 5, 2021 10:19
Run spotify/kafka docker
docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka
docker run -it --rm spotify/kafka /bin/bash
$KAFKA_HOME/bin/kafka-console-producer.sh --broker-list 172.17.0.2:9092 --topic test
docker run -it --rm spotify/kafka /bin/bash
$KAFKA_HOME/bin/kafka-console-consumer.sh --zookeeper 172.17.0.2:2181 --topic test
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
class MyWorker
include Sidekiq::Worker
sidekiq_options unique_for: 10.minutes
def perform(...)
end
end
#!/bin/bash
# Trap sigterm and sleep before passing signal to child for $SIGNAL_TIMEOUT seconds
# this is to address a shutdown issue with traefik: https://docs.traefik.io/user-guide/marathon/#shutdown
cmd=${*}
# default to 10 seconds
SIGNAL_TIMEOUT=${SIGNAL_TIMEOUT:-10}
log() {
@edgar
edgar / default_syntax.py
Created May 18, 2018 20:22
Use Markdown as default language for new docs.
# Add this script in your SublimeText Packages/User directory
import sublime, sublime_plugin
class DefaultSyntaxCommand(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/Markdown/Markdown.tmLanguage')
@edgar
edgar / The Technical Interview Cheat Sheet.md
Created July 2, 2018 16:26 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@edgar
edgar / latency.txt
Created August 12, 2018 20:49 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@edgar
edgar / docker-compose.yml
Created April 21, 2020 21:22 — forked from seanhandley/docker-compose.yml
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@edgar
edgar / resque.rake
Created July 2, 2020 00:36 — forked from ewherrmann/resque.rake
Collection of Resque related custom rake tasks from around the web
require 'resque/tasks'
namespace :resque do
def del(key)
Resque.redis.keys(key).each { |k| Resque.redis.del(k) }
end
desc "Resque setup according to installation guide"
task :setup => :environment