Skip to content

Instantly share code, notes, and snippets.

@cookieguru
cookieguru / update-fork-using-rebase.sh
Created May 5, 2017 23:24
Updating a fork using git rebase instead of merge
git clone [email protected]:yourname/repo-name.git
cd repo-name
git remote add upstream https://github.com/original-user/repo-name.git
git checkout master
git fetch upstream
git rebase upstream/master
git push
@raelga
raelga / rdd-to-sql
Last active October 30, 2021 05:23
Export munin data to SQL.
echo 'DROP TABLE munin;' > munin.sql
echo 'CREATE TABLE munin (id SERIAL PRIMARY KEY, node VARCHAR(10), data VARCHAR(50), value FLOAT, time TIMESTAMP WITH TIME ZONE);' >> munin.sql;
echo 'BEGIN;' >> munin.sql;
for rrd in *rrd;
do
rrdtool dump $rrd $rrd.xml;
host=`echo $rrd | sed 's/\(.*\)_\(.*\)\.rrd/\1/'`;
data=`echo $rrd | sed 's/\(.*\)_\(.*\)\.rrd/\2/'`;
sed -n "s@.*-- \(.* CEST\).*<v>\(.*\)</v></row>@INSERT INTO munin (node,data,value,time) VALUES (\'$host\',\'$data\',\'\2\',\'\1\');@p" $rrd.xml >> munin.sql;