Skip to content

Instantly share code, notes, and snippets.

View fidelisrafael's full-sized avatar
🏠
Working from home

Rafael Fidelis fidelisrafael

🏠
Working from home
  • https://web.archive.org/web/20221024062310/http://www.fidelis.work/
  • Brasil
  • 01:25 (UTC -03:00)
View GitHub Profile
@fidelisrafael
fidelisrafael / docker-run-redis.md
Created February 16, 2021 00:35 — forked from sskoopa/docker-run-redis.md
Start redis in Docker with a open port at localhost:6379

docker run --name recorder-redis -p 6379:6379 -d redis:alpine

@fidelisrafael
fidelisrafael / web-servers.md
Created April 8, 2020 17:24 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@fidelisrafael
fidelisrafael / enzyme_render_diffs.md
Created April 3, 2020 22:08 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
killall ssh-agent; eval `ssh-agent`
// node.js proxy server example for adding CORS headers to any existing http services.
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities
var httpProxy = require('http-proxy'),
express = require('express');
var proxy = new httpProxy.RoutingProxy();
var proxyOptions = {
host: '192.168.3.11',
@fidelisrafael
fidelisrafael / ruby_multi_threading.rb
Last active January 22, 2019 03:18
This gist compares the use of Threaded and non-Threaded Ruby code to perform IO(Read/Write) on a shared file.
gem 'thread' # gem install thread
require 'thread/pool'
@semaphore = Mutex.new
LOOPS_COUNT = (ENV['LOOPS_COUNT'] || 100).to_i
POOL_SIZE = (ENV['POOL_SIZE'] || LOOPS_COUNT).to_i
def with_thread_without_mutex!(num_loops = 100)
@fidelisrafael
fidelisrafael / bash-colors.md
Created September 1, 2018 19:13 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@fidelisrafael
fidelisrafael / break.py
Created August 29, 2018 19:39 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))

Basic

import code; code.interact(local=locals())

Advanced

IPython with embed()

@fidelisrafael
fidelisrafael / thread-pool.rb
Created February 14, 2018 05:23 — forked from rosenfeld/thread-pool.rb
Simple thread pool implementation in Ruby
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end