Skip to content

Instantly share code, notes, and snippets.

View raelga's full-sized avatar
🐱
Learning

Rael Garcia raelga

🐱
Learning
View GitHub Profile
import hashlib
for i in hashlib.algorithms_available:
t = "sophie1";
h = hashlib.new(i);
h.update(t);
th = h.hexdigest();
print(t+" > "+i+" > "+h.hexdigest());
@raelga
raelga / sp
Last active August 29, 2015 14:23 — forked from wandernauta/sp
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@raelga
raelga / install-firefox
Last active August 29, 2015 14:00
Install Last Firefox
#!/bin/bash
export URL="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-GB/";
mkdir -p /opt/mozilla/;
curl -L `curl -L $URL | sed -n 's@.*\(firefox-.*tar.bz2\)<.*@'$URL'/\1@p'` | sudo tar -jx -C /opt/mozilla/;
@raelga
raelga / gist:7211025
Last active December 26, 2015 20:48
Java
for i in `find /usr/lib/jvm/last-jdk/bin/`;
do
b=`basename $i`;
update-alternatives --remove $b $i;
update-alternatives --install /usr/bin/$b $b $i 90000;
update-alternatives --set java $i;
done
unlink /opt/google/chrome/plugins/libnpjp2.so
unlink /usr/lib/mozilla/plugins/libnpjp2.so
<?php
$source_file = "test_image.jpg";
// histogram options
$maxheight = 300;
$barwidth = 2;
$im = ImageCreateFromJpeg($source_file);
@raelga
raelga / gist:6000743
Last active December 19, 2015 18:39
Divide and look for badblocks
#!/bin/bash
if [ -z $1 ]
then
echo "Usage: $0 sdx"
exit
elif [ `echo $1 | grep -c '/dev/'` -eq 0 ]
@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;