Skip to content

Instantly share code, notes, and snippets.

View andersonfreitas's full-sized avatar

Anderson Freitas andersonfreitas

View GitHub Profile
@andersonfreitas
andersonfreitas / gist:3789796
Created September 26, 2012 18:47 — forked from sandinist/gist:1659881
forward-delete in IRB and ZSH

iTerm2

  • Go to iTerm > Preferences... > Keys
  • Add a Global Shortcut Key
  • Type the delete key as Shortcut
  • Select Send Hex Codes as Action and type 0x004
  • Click on OK and you're good to go

zsh

@andersonfreitas
andersonfreitas / gist:4355992
Last active June 24, 2021 13:29
Installing nmon on Amazon Linux AMI

Installing nmon on Amazon Linux AMI

nmon is an excellent performance monitor for Linux systems.

Since Amazon Linux AMI is compatible with RHEL5, I've downloaded a binary RPM from:

http://pkgs.repoforge.org/nmon/

$ wget http://pkgs.repoforge.org/nmon/nmon-14g-1.el5.rf.i386.rpm
data:text/html,<html onclick="javascript:requestFullscreen()"><head><title>Black full screen</title></head><div class="container"> <div class="child">Click to enter full screen</div> </div><style>html {background: black; color: darkgray} :fullscreen{color: black} .container { display: flex; justify-content: center; align-items: center; height: 100%; font-family: Google sans; }</style>
@andersonfreitas
andersonfreitas / derivative.js
Created April 18, 2014 17:43
derivative in js
function derivative(f) {
var h = 0.001;
return function(x) { return (f(x + h) - f(x - h)) / (2 * h); };
}
console.log(" cos(2) = " + Math.cos(2));
console.log("-sin(2) = " + Math.sin(2));
console.log("(d cos/dx)(2) = " + derivative(Math.cos)(2));
function f(x) { return Math.pow(x, 3) + 2 * x + 1; };
@andersonfreitas
andersonfreitas / html2canvas.js
Created September 24, 2012 02:24
Snippet to load html2canvas in the actual page
this.scriptObject=document.createElement('script');
this.scriptObject.type='text/javascript';
this.scriptObject.src='http://html2canvas.hertzen.com/js/html2canvas.js';
var ssc = document.getElementsByTagName('script')[0];
ssc.parentNode.insertBefore(this.scriptObject, ssc);
this.scriptObject=document.createElement('script');
this.scriptObject.type='text/javascript';
this.scriptObject.src='http://html2canvas.hertzen.com/js/jquery.plugin.html2canvas.js';
set(CMAKE_CXX_COMPILER icpc)
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
SET(CMAKE_CXX_FLAGS_INIT "-std=c++0x")
SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG -ipo")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
@andersonfreitas
andersonfreitas / gist:9425873
Created March 8, 2014 05:40
CentOS "Development Tools" for OpenGL
sudo yum groupinstall "Development Tools"
sudo yum install mesa*
sudo yum install libXrandr*
sudo yum install libXext*
sudo yum install libX11*
sudo yum install libXi*
sudo rpm -ivH http://pkgs.repoforge.org/cmake/cmake-2.8.8-1.el6.rfx.i686.rpm
@andersonfreitas
andersonfreitas / subdomains.rb
Created September 12, 2012 14:08 — forked from rtekie/subdomains.rb
Support for Rspec / Capybara subdomain integration testing
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"
# Check style:
proof:
echo "weasel words: "
sh bin/weasel *.tex
echo
echo "passive voice: "
sh bin/passive *.tex
echo
echo "duplicates: "
perl bin/dups *.tex