Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / web-servers.md
Created November 15, 2016 16:18 — 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
@epcim
epcim / 0_reuse_code.js
Created November 16, 2016 10:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@epcim
epcim / contrail-db-wipe
Created November 18, 2016 09:57 — forked from ajayhn/contrail-db-wipe
Contrail DB wipe.
[Cleanup-Steps]
0. Deleted all service-instances, VMs, networks.
1. service supervisor-webui stop on all contrail controllers
2. service supervisor-analytics stop on all contrail controllers
3. service supervisor-config stop on all contrail controllers
4. service supervisor-control stop on all contrail controllers
5. service supervisor-database stop on all contrail controllers
6. service zookeeper stop on all contrail controllers
7. mv /var/lib/cassandra /var/lib/cassandra.old
8. mv /var/lib/zookeeper/version-2 /var/lib/zookeeper/version-2.old
@epcim
epcim / contrail-backup-restore.txt
Created November 18, 2016 09:57 — forked from dsundarraj/contrail-backup-restore.txt
Contrail backup and restore
Contrail database backup/restore procedure
This procedure can be used to backup contrail database (except the ContrailAnalytics keyspace) during upgrade from R2.20#64 to R2.22.1#5. Incase of database corruption during the upgrade process, the backed up database can be restored on the cluster. The below procedure can be used to backup/restore contrail database except the ContrailAnalytics keyspace.
1.1 Dropping ContrailAnalytics keyspace before upgrade
If the user prefers to drop the ContrailAnalytics data before upgrading the cluster, then the following can be done:
From FAB_NODE, execute “fab stop_collector”
5 instances of following output each 2 seconds apart,
“ifconfig –a”
Vif –b
Dropstats
Vrfstats —get <vrf-id> , where vrf-id is Vrf for tap-interface of interest
First page of “flow –l | more” output
http://<compute>:8085/Snh_SandeshTaskRequest?
Contrail Upgrade procedure – Minimal downtime
WARNING: This procedure only works for upgrades between Contrail versions PRIOR TO 3.0. Starting with 3.0, Cassandra version changes and this involves more work.
NOTE: This procedure is *UNSUPPORTED* because fab adds much more error-checking logic than what you can see here. Use this procedure at your own risk.
This document is inspired on another one ( https://gist.github.com/dsundarraj/9dde07f28208737c7729 ), but it breaks the fab steps into commands run on each of the nodes separately.
Upgrade procedure to minimize downtime in the production network. Upgrade controller and compute separately. The procedure is based on fab upgrade_contrail.
@epcim
epcim / heat_contrail_service_chain.yaml
Created November 18, 2016 10:03 — forked from virtualhops/heat_contrail_service_chain.yaml
Heat template to create a v2 Service Chain in Contrail (thanks Ganesha, Nicolas, Bernhard). It is verified to work in Contrail version 3.0.2.
heat_template_version: 2015-04-30
parameters:
management_network:
type: string
description: Name of management network to be created
left_vn:
type: string
description: Name of left network to be created
right_vn:
#!/usr/bin/env ruby
require 'yaml'
def parse_yaml(cl, align = '')
puts align + cl
reclass_dir = '/srv/salt/reclass'
yaml_file = if cl =~ /\.yml$/
cl
elsif File.exist?(reclass_dir + '/classes/' + cl.tr('.', '/') + '/init.yml')

Signing someone else key

Get key to sign

gpg --list-keys

Sign the key

gpg --sign-key --ask-cert-level 0xXXXXXXXXX
@epcim
epcim / gpg.md
Last active March 24, 2017 14:40 — forked from ruben-rodriguez/GPG.txt
GPG & github gpg sign

create

gpg --gen-key 

list

gpg --list-keys
gpg -k

Above command will show the key from the public keyring. To view the secret key ring, use- gpg --list-secret-keys (OR gpg -K)