Skip to content

Instantly share code, notes, and snippets.

View oprietop's full-sized avatar
🤘
Forking

Oscar Prieto oprietop

🤘
Forking
  • NERV
  • Court Of The Crimson King
View GitHub Profile
@oprietop
oprietop / rclone_loop.sh
Created October 27, 2016 09:11
Looping a rclone transfer to test google drive throughput and errors.
#!/usr/bin/env sh
set -x # Be verbose
set -u # Exit if unbound variables
FILE="/home/user/bigfile.iso"
DEST="gdrive_user"
DIR="test"
while true; do
@oprietop
oprietop / newcue_kc.pl
Created December 31, 2016 21:32
Getting some help to tag a bunch of single flac+cue files.
#!/usr/bin/perl
use strict;
use Cwd;
use File::Find;
my $dir = $ARGV[0] || $ENV{PWD};
chdir($dir);
my $dir= getcwd();
print "$dir\n";
@oprietop
oprietop / python27_graphite.py
Last active January 27, 2017 09:26
Easy wrapper to push stuff to graphite
#!/usr/bin/env python2.7
# -*- coding: utf8 -*-
import time
import random
import socket
def main():
dic = {}
for i in range(1,10):
dic['key_'+str(i)] = random.randint(1, 100000)
@oprietop
oprietop / aw.pl
Created January 30, 2017 08:07
Getting stats from aqmetrix
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Cookies;
use Term::ANSIColor qw(:constants);
@oprietop
oprietop / collectd.txt
Created February 13, 2017 15:39
Simple collectd Exec plugin example
# plugin_exec.conf
LoadPlugin exec
<Plugin exec>
Exec "user" "/opt/collectd/etc/metrics/grep_stuff.sh"
</Plugin>
# grep_stuff.sh
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
@oprietop
oprietop / fast_sslcert.sh
Last active November 29, 2017 11:39
Bourne Shell script to create self-signed certs
#!/bin/sh
# We can set our CN using it as an argument
[ -n "$1" ] && CN=$1 || CN=localhost
# RSA params
RSA=2048
DAYS=365
# subj Params
@oprietop
oprietop / 3g_orange.sh
Last active April 12, 2017 08:52
wdial wrapper for 3G orange modems
#!/bin/bash
# wdial wrapper for 3G orange modems
set +o posix
ok() { echo -ne "\e[32m#\n#\t$1\n#\e[m\n"; }
nk() { echo -ne "\e[31m#\n#\t$1\n#\e[m\n"; exit 1; }
[ -c /dev/ttyHS0 ] && [ -c /dev/ttyHS1 ] && {
USB1=/dev/ttyHS3 # Globetrotter HSUPA Modem (aka icon 451)
USB2=/dev/ttyHS3
PIN=
@oprietop
oprietop / pycuin.py
Last active September 23, 2019 15:47
Customizable CurlMulti Wrapper with influxdb support.
#!/usr/bin/env python -u
# -*- coding: utf8 -*-
import json
import pycurl
from io import BytesIO
from urllib.parse import urlencode, urlparse
from influxdb import InfluxDBClient
# Configuration Defaults
@oprietop
oprietop / graphite_events.py
Created May 5, 2017 11:35
Trying the graphite events api
#! /usr/bin/python
# -*- coding: utf8 -*-
# http://graphite.readthedocs.io/en/latest/events.html
import time
import requests
host = "http://graphite/events/"
epoch = int(time.time())
@oprietop
oprietop / influxdb_requests.py
Last active September 23, 2019 15:43
Playing with influxdb's http API
#! /usr/bin/python
# -*- coding: utf8 -*-
import os
import json
import time
import requests
from requests.adapters import HTTPAdapter