Skip to content

Instantly share code, notes, and snippets.

@kabakaev
kabakaev / puppet-hiera-yaml-check-syntax
Created May 22, 2015 15:59
checks syntax of all yaml files found under ./hiera directory. It is useful to check Hiera syntax and it should be run from the root of a puppet project
for i in `find hiera -name "*.yaml"`
do
echo $i
ruby -e "require 'yaml'; YAML.parse(File.open('$i'))"
done
@kabakaev
kabakaev / 0_reuse_code.js
Last active August 29, 2015 14:21
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
@kabakaev
kabakaev / new_gist_file_0
Created May 22, 2015 16:17
rename canon photo camera files
#!/bin/bash -x
echo 'Canon flash card JPG file names will be fixed.'
echo 'Namely, the leading underscore _ will be replaced with I.'
echo 'I.e., _MG will be replaced with IMG in current folder.'
for i in _* ; do mv $i I${i#*_} ; done
@kabakaev
kabakaev / simulate_hiera.sh
Last active August 29, 2015 14:22
simulate Hiera run in CLI
# or hiera --hash \
hash='rkt_base::monitor::icinga2::is_server'; \
env='staging'; \
role='puppet'; \
role2='monitor'; \
role3='log'; \
countrycode='id'; \
hiera \
@kabakaev
kabakaev / clean_puppet_db.sql
Last active August 29, 2015 14:22
Clean exported resources from PuppetDB
# su - postgres
# psql
delete from public.resource_params_cache where parameters like '%live-some-nodename-db-02.project.conf%';
delete from public.resource_params where value like '%live-some-nodename-db-02.project.conf%';
@kabakaev
kabakaev / update_librarian-puppet.sh
Created June 11, 2015 15:22
upgrade librarian-puppet-simple
cd ; mkdir src; cd src/
git clone https://github.com/kabakaev/librarian-puppet-simple.git
cd librarian-puppet-simple/
gem uninstall librarian-puppet-simple
gem build librarian-puppet-simple.gemspec
gem install librarian-puppet-simple-0.0.5.gem
apt-get upgrade libmysqlclient18 -V
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
apache2-utils (2.2.22-13+deb7u3 => 2.2.22-13+deb7u4)
apt (0.9.7.9+deb7u6 => 0.9.7.9+deb7u7)
apt-transport-https (0.9.7.9+deb7u6 => 0.9.7.9+deb7u7)
apt-utils (0.9.7.9+deb7u6 => 0.9.7.9+deb7u7)
base-files (7.1wheezy7 => 7.1wheezy8)
ruby -e "require 'yaml'; yaml = YAML.load_file('ventures.sls'); puts yaml.inspect"
mysqldumper $paramaters | perl -pe 's/\sDEFINER=`[^`]+`@`[^`]+`//' > fixed.sql
#!/bin/bash -x
echo this command will stream from macbook pro FaceTime webcam to youtube
echo you may wish to run \"brew install ffmpeg\" to get it working
youtube_streaming_key=$1
[ -Z "$youtube_streaming_key" ] && youtube_streaming_key='xxxx-xxxx-xxxx-xxxx'
youtube_rtmp_url='rtmp://a.rtmp.youtube.com/live2'