Skip to content

Instantly share code, notes, and snippets.

View marcoemorais's full-sized avatar

Marco Morais marcoemorais

  • Yahoo!
  • Santa Clara
View GitHub Profile
@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:
@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 / 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
# 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 / 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
@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: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 / basic-with-neutron.yaml
Created August 20, 2014 23:23
Anvil configuration for icehouse with neutron
---
components:
# Order matters here!
- general
- db
- rabbit-mq
# Oslo libraries
- oslo-config
- oslo-messaging
- pycadf
# reset root password
o Stop MySQL
$ sudo /sbin/service mysqld stop
o Restart it manually with the skip-grant-tables option:
$ mysqld_safe --skip-grant-tables
o Run the MySQL client:
$ mysql -u root
o Reset the root password manually with this MySQL command:
mysql> UPDATE mysql.user SET Password=PASSWORD('XXX') WHERE User='root';
o Flush the privileges with this MySQL command:
(rallyve)mmorais@displaytoday rally$ rally --verbose task start --deploy-id=4f449b2d-ba2d-4096-a7a8-2e77969b3bae --task dummy.json
/home/mmorais/rallyve/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
================================================================================
Task a4ff5c81-a60d-4a34-93bc-41f25e1d337c is started
--------------------------------------------------------------------------------
2014-06-19 17:37:17.720 24773 INFO rally.orchestrator.api [-] Benchmark Task a4ff5c81-a60d-4a34-93bc-41f25e1d337c on Deployment 4f449b2d-ba2d-4096-a7a8-2e77969b3bae
2014-06-19 17:37:17.720 24773 INFO rally.benchmark.engine [-] Task a4ff5c81-a60d-4a34-93bc-41f25e1d337c | Starting: Check cloud.
2014-06-19 17:37:18.037 24773 INFO rally.benchmark.e