Skip to content

Instantly share code, notes, and snippets.

@rd2b
rd2b / jeedom-methodapi.py
Created July 30, 2015 12:27
Call Jeedom method using JsonRPC and python
import urllib2
import urllib
import json
ip_jeedom = '192.168.XXX.XXX'
Api_key = 'XXXXXXXMyAPIKYEXXXXX'
def Jeedom(id, value):
parameters = {
@rd2b
rd2b / jeedom.py
Created July 24, 2015 13:40
Get Jeedom Value from python script
#!/usr/bin/env python
""" jeedom.py : How to jeedom value in python """
__author__ = "Rémi"
__date__ = "2015/07/24"
import urllib
@rd2b
rd2b / bacula.sql
Created February 20, 2013 16:00
SQL requests for bacula
/**
* Voir Les logs
*/
CREATE VIEW LOGS AS SELECT * FROM Log INNER JOIN Job ON Log.JobId = Job.JobId;
/**
* Voir tous les resultats
*/
CREATE VIEW Results AS SELECT * FROM Client JOIN Job ON Client.ClientId = Job.ClientId;
/**
@rd2b
rd2b / virshdestroy.sh
Last active December 11, 2015 11:19
Commands for virsh and KVM
# Stops All running virtual machines :
for i in $(virsh list |sed -n "s/.*\s\(.*local\).*running/\1/ p")
do
virsh destroy $i
done
@rd2b
rd2b / gist:4444382
Last active December 10, 2015 13:58
Requetes pour bacula
/**
* Voir Les logs
*/
CREATE VIEW LOGS AS SELECT * FROM Log INNER JOIN Job ON Log.JobId = Job.JobId;
/**
* Voir tous les resultats
*/
CREATE VIEW Results AS SELECT * FROM Client JOIN Job ON Client.ClientId = Job.ClientId;
/**
@rd2b
rd2b / gitlist.sh
Last active December 10, 2015 05:28
Lists gists and github repositories and clone them from the Github API.
# Set the user:
user="rd2b"
# Lists gists URLS:
curl -s https://api.github.com/users/$user/gists | sed -n 's/.*git_pull_url.*"\(.*\)".*/\1/ p'
# Lists github repositories:
curl -s https://api.github.com/users/$user/repos | sed -n 's/.*clone_url.*"\(.*\)".*/\1/ p'
# Clone all gists :
@rd2b
rd2b / use.sh
Last active December 10, 2015 05:28
Gentoo/Portage make.conf file for my AMD Athlon64 4600+ It runs mostly XFCE with Amarok and Firefox
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -march=k8 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="apng alsa bash-completion consolekit dbus embedded gudev hwdb libkms
@rd2b
rd2b / freebox.sh
Last active December 10, 2015 05:28
Sets and updates the blocklist ip from Bluetack in a Seedbox running transmission. This is specially usefull for the french ISP Free and his Freebox
# Update this to feet your own seedbox:
seedbox="mafreebox.freebox.fr"
login="freebox"
password="XXXXXXX"
URL="http://$seedbox:9091/transmission/rpc"
curl -v $URL -u $login:$password -d '{"arguments":{"blocklist-enabled":true}, "method":"session-set"}'
curl -v $URL -u $login:$password -d '{"arguments":{"blocklist-url":"http://www.bluetack.co.uk/config/level1.gz"}, "method":"session-set"}'
curl -v $URL -u $login:$password -d '{"method":"blocklist-update"}'