Skip to content

Instantly share code, notes, and snippets.

@pmoranga
pmoranga / rpm-build-workflow.md
Created April 1, 2017 21:39 — forked from abn/rpm-build-workflow.md
RPM build and hosting workflow using github, travis-ci and copr

RPM Build Flow

This document details simple RPM build flow pattern used to build and host RPM artifacts for open source projects. The below is a visual summary of this flow.

In order to achieve this multiple tools and services are used. The services and their purpose in the flow is as listed below.

Service Purpose
GitHub As is the most common use for GitHub, it holds the build source code. In this case we hold only the spec files and related source files. All other sources, including project binaries/sources are retrieved at build time.
# Server mechanics
bind = '0.0.0.0:8000'
backlog = 2048
daemon = False
pidfile = None
umask = 0
user = None
group = None
tmp_upload_dir = None
proc_name = None
@pmoranga
pmoranga / cloud-config.yml
Created October 13, 2016 14:36 — forked from robeastham/cloud-config.yml
This is a cloud-config file template for Rancher OS. Fill in the blanks and it'll automatically setup your Rancher Server behind an Nginx proxy and register Let's Encrypt SSL certs and then renew them automatically
#cloud-config
ssh_authorized_keys:
- ssh-rsa <my-public-key>
rancher:
services:
nginx-proxy:
image: jwilder/nginx-proxy:0.4.0
restart: unless-stopped
ports:
- "80:80"
@pmoranga
pmoranga / extract_windows_certificate_from_installer.md
Created September 16, 2016 09:54
Get the (readable) certificate from a windows executable (PE)

Get the (readable) certificate from a windows executable (PE)

From: http://web.fournier.nl/2013/10/get-readable-certificate-from-windows.html

I searched high and low for a simple (linux) solution on how to extract the certificate of an authenticode signed windows binary. I don't want to use wine, nor mono. This is what I came up with:

  • Extract the certificate with 7zip: 7z e setup.exe CERTIFICATE
  • remove the first 8 bytes: dd if=CERTIFICATE bs=1 skip=8 of=setup.exe.pkcs7
  • Read it: openssl pkcs7 -in setup.exe.pkcs7 -inform DER -print_certs -text
@pmoranga
pmoranga / mass-aggregation-change.sh
Created May 31, 2016 13:19 — forked from kirbysayshi/mass-aggregation-change.sh
quick examples of how to change many many wsp (graphite/whisper) files settings
for f in $(find $1 -iname "*.wsp"); do
if [ -a $f ];
then /opt/graphite/bin/whisper-set-aggregation-method.py $f max;
fi;
done
@pmoranga
pmoranga / .bash-colors
Created May 30, 2016 19:08 — forked from jaycody/.bash-colors
.bash-colors
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
@pmoranga
pmoranga / raspisys.php
Last active May 16, 2016 20:31
Forked Raspberry Pi System Information PHP Script - Mobile Friendly Version and Misc Tweaks
<?php
// Original Gist By: Jan van Haarst
// Original Gist: https://gist.github.com/4388108
// Forked Gist By: Jon Faviell
// Forked Gist: https://gist.github.com/7e9138acb3975f8d886c
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
@pmoranga
pmoranga / ec2tags.rb
Last active February 16, 2016 22:30 — forked from tmclaugh/ec2tags.rb
require 'facter'
require 'aws-sdk'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
ec2 = Aws::EC2::Client.new(region:region)
tags = ec2.describe_tags(filters: [{ name: "resource-id", values: [instance_id] }]).tags
tags.each do |tag|
fact = "ec2_tag_#{tag["key"].gsub(/\-|\/|:/, '_')}"
@pmoranga
pmoranga / gist:2db7b5d1e0c120a7de70
Created February 15, 2016 23:46
Puppet external fact for EC2 Tags
#!/bin/bash
region=`facter ec2_placement_availability_zone | sed 's/[a-z]$//g'`
instanceId=`facter ec2_instance_id`
/usr/bin/aws ec2 describe-tags --filters "Name=resource-id,Values=${instanceId}" --region ${region} | jq '.Tags[] | "ec2_tag_" + .Key + "=" + .Value' | tr [:upper:] [:lower:] | tr -d '"'
exit 0
@pmoranga
pmoranga / $conf_dir puppet.conf
Created February 13, 2016 21:30 — forked from abhishekkr/$conf_dir puppet.conf
Puppet Module : No Code In Data ~ using PuppetDB in masterless puppet
[main]
storeconfigs = true
storeconfigs_backend = puppetdb
reports = store,puppetdb
pluginsync = true