Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Rafael Fidelis fidelisrafael

🏠
Working from home
Block or report user

Report or block fidelisrafael

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View restart-ssh-gist.sh
killall ssh-agent; eval `ssh-agent`
View cors-middleware-express-with-proxy.js
// 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 Jan 22, 2019
This gist compares the use of Threaded and non-Threaded Ruby code to perform IO(Read/Write) on a shared file.
View ruby_multi_threading.rb
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 Sep 1, 2018 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.
View bash-colors.md

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 Aug 29, 2018 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
View break.py
import code; code.interact(local=dict(globals(), **locals()))
@fidelisrafael
fidelisrafael / thread-pool.rb
Created Feb 14, 2018 — forked from rosenfeld/thread-pool.rb
Simple thread pool implementation in Ruby
View thread-pool.rb
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
@fidelisrafael
fidelisrafael / human-numbers.cpp
Created Feb 1, 2018 — forked from cslarsen/human-numbers.cpp
Convert big number to human readable format
View human-numbers.cpp
/*
* A simple way to format numbers as human readable strings.
* E.g., 123456789 ==> 123 million
*
* Written by Christian Stigen Larsen
* http://csl.sublevel3.org
*
* Placed in the public domain by the author, 2012
*/
@fidelisrafael
fidelisrafael / feeds.py
Created Dec 4, 2017 — forked from ksamuel/feeds.py
RSS/Atom link auto detection. Use feedparser and beautifulsoup
View feeds.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
"""
Tools to extract feed links, test if they are valid and parse them
with feedparser, returning content or a proper error.
"""
@fidelisrafael
fidelisrafael / switch_touchscreen.sh
Last active Nov 20, 2017
Disable touchscreen on OpenSuse Leap 42.2 and others linux distros (ATTENTION: You must install `xinput` package for your distro) Original: https://ubuntuforums.org/showthread.php?t=2100744
View switch_touchscreen.sh
#! /bin/bash
# switch_touchscreen.sh
# https://ubuntuforums.org/showthread.php?t=2100744
# Use `xinput --list` to list all devices and find your touchscreen
# sudo chmod a+x switch_touchscreen.sh
DEVICE="Atmel Atmel maXTouch Digitizer"
STATUS=`xinput list-props "$DEVICE" | grep 'Device Enabled' | sed 's/.*\([0-9]\)$/\1/'`
if [ "$STATUS" = "1" ]
You can’t perform that action at this time.