Skip to content

Instantly share code, notes, and snippets.

View cliffano's full-sized avatar
🎧
Hustlin' hustlin' hustlin' hustlin' hustlin'

Cliffano Subagio cliffano

🎧
Hustlin' hustlin' hustlin' hustlin' hustlin'
View GitHub Profile
@cliffano
cliffano / wait-for-fact.sh
Created July 29, 2016 01:20
wait for the existence of a facter fact via shell
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: check-fact <fact_name>" >&2
exit 1
fi
name=${1}
max_retries=60
@cliffano
cliffano / s3staticsite_route53a.tf
Created May 26, 2016 22:42
Terraform configuration for setting up S3 static site bucket with a Route53 A record.
variable "bucket_site" {}
variable "region" {}
variable "route53_domain_name" {}
variable "route53_domain_zoneid" {}
variable "route53_domain_alias_name" {}
variable "route53_domain_alias_zoneid" {}
provider "aws" {
region = "${var.region}"
}
@cliffano
cliffano / clean_puppetdb.sh
Created April 27, 2016 00:25
Deactivate and clean nodes in PuppetDB
#!/bin/bash
domains="domain1.xyz domain2.xyz"
for DOMAIN in ${domains}; do
puppet node deactivate ${DOMAIN}
puppet node clean ${DOMAIN}
done
@cliffano
cliffano / set_stash_group_permission.sh
Created April 19, 2016 01:27
Add group permission to multiple Stash repositories
#!/bin/bash
user=<user>
pass=<pass>
base_url=<http://stash_host:stash_port>
project=<project>
repos="<repo1> <repo2> ... <repoN>"
permission=<REPO_READ|REPO_WRITE|REPO_ADMIN>
group=<group>
@cliffano
cliffano / couchdb2couchpenter.js
Created September 2, 2015 23:11
Retrieve all database names in a CouchDB database and create a Couchpenter config.
var fs = require('fs');
var http = require('http');
var url = require('url');
if (process.argv.length !== 3) {
console.error('Usage: node couchdb2couchpenter.js https://host:port');
process.exit(1);
}
var _url = url.parse(process.argv[2]);
@cliffano
cliffano / gist:b268c090f905eccf35fe
Last active August 29, 2015 14:17
npmjs registry intermitten failure
> openssl s_client -connect registry.npmjs.org:443 -prexit
CONNECTED(00000003)
write:errno=54
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 130 bytes
@cliffano
cliffano / gist:b47b389721fe5a3403f9
Created November 5, 2014 15:26
pkjutil traverse-dependencies
* [email protected]
- dependencies:
- async: ~0.9.0
- bagofcli: ~0.2.0
- bagofrequest: ~0.1.0
- colors: ~1.0.3
- lodash: ~2.4.1
- prod: ~1.0.0
- semver: ~4.1.0
- devDependencies:
@cliffano
cliffano / gist:b86e7a6ddf4d1c451e3e
Created June 2, 2014 08:44
app.js dynamic list
The html page:
<div class="app-page" data-page="blah">
<div class="app-topbar">
<div class="app-title">Blah</div>
</div>
<div class="app-content">
<ul id="somelist" class="app-list">
<li class="app-button" data-target="sometarget">Foo</li>
</ul>
# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@cliffano
cliffano / gist:5931066
Last active December 19, 2015 09:09
child_process bg
>>> cat blah.js
var cp = require('child_process');
var c = cp.exec('./blah.sh &', function (err) {
if (err) {
console.error('err: ' + err.message);
} else {
console.log('done');
}
});