Skip to content

Instantly share code, notes, and snippets.

View marcoemorais's full-sized avatar

Marco Morais marcoemorais

  • Yahoo!, AWS, NVIDIA
  • Santa Clara
View GitHub Profile
@marcoemorais
marcoemorais / gist:c2e4f99603de6547f284
Created September 5, 2014 16:50
python virtualenv notes
### python-virtualenv-notes ###
Notes from virtualenv documentation on pypi http://pypi.python.org/pypi/virtualenv
o Install
o instructions for installing
http://www.virtualenv.org/en/latest/#installation
o in case you haven't already install pip
$ sudo apt-get install python-pip
OR
@marcoemorais
marcoemorais / gist:4edd8b40f640423d3ae8
Last active August 29, 2015 14:08
look at the contents of an rpm without installing it on your system
#!/usr/bin/env bash
EXPECTED_ARGS=2
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` rpm-file target-dir"
exit 1
fi
@marcoemorais
marcoemorais / gist:23926d8517414b158d23
Created November 14, 2014 01:48
useful sar counters
# canonical sar command invocation
sar -f [FILE] [flags] [interval] [count]
# general purpose flags
# -f [FILE] refers to a file in /var/log/sa/saXX where XX is the day of month
# -o [FILE] capture all performance data in a binary file to be read with sar later
# Note: *all* performance counters are captured by default
# -p flag will pretty print device names rather than using dev{m}-{n} format
# when [interval] is 0 sar will report statistics for time since boot
# find the IP addresses of many hosts on the network
# step 1. obtain the broadcast address from ifconfig
# step 2. ping the broadcast address
$ ifconfig -a | grep broadcast
inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255
inet 192.168.68.1 netmask 0xffffff00 broadcast 192.168.68.255
inet 192.168.174.1 netmask 0xffffff00 broadcast 192.168.174.255
$ ping 192.168.1.255
PING 192.168.1.255 (192.168.1.255): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=0.634 ms
@marcoemorais
marcoemorais / tmux-howto.txt
Created October 21, 2016 00:05
tmux notes
# *** tmux subcommands ***
# start a new tmux session
tmux new-session -s [session-name]
# start a new tmux session with a named window
tmux new-session -s [session-name] -n [window-name]
# list running sessions
@marcoemorais
marcoemorais / all_demo.py
Last active January 25, 2017 14:52
Marco's pandas examples with DataFrame
#!/usr/bin/env python
import unittest
import pandas as pd
class AllTest(unittest.TestCase):
def test_all(self):
@marcoemorais
marcoemorais / Visitor-Pattern-variant.cpp
Created October 20, 2023 05:06
Object oriented (OO) implementation of the Visitor pattern.
#include <variant>
#include <vector>
using namespace std;
class Circle;
class Square;
class DrawVisitor {
public: