Skip to content

Instantly share code, notes, and snippets.

View cathoderay's full-sized avatar

Ronald Andreu Kaiser cathoderay

  • Rio de Janeiro, Brazil
View GitHub Profile
@cathoderay
cathoderay / absolute_path.sh
Created January 26, 2019 19:25
Absolute path from within bash script
echo "$(cd `dirname $0` && pwd)"
@cathoderay
cathoderay / gist:6114562
Created July 30, 2013 16:32
video cutting
# extracts first 5 minutes
ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:05:00 output1.avi
@cathoderay
cathoderay / get_urls.py
Created August 19, 2012 02:21
get urls from an url
import requests
from lxml.html import fromstring
def get_urls(url):
return fromstring(requests.get(url).text).xpath('//a/@href')
print get_urls('http://www.google.com')
@cathoderay
cathoderay / decorators.py
Created March 1, 2012 18:05
decorators examples
#!/usr/bin/env python
"""
File: decorators.py
Description: decorators examples
Author: Ronald Kaiser <raios dot catodicos at gmail dot com>
"""
import time
@cathoderay
cathoderay / perf.pl
Created January 31, 2012 20:40
Lognit performance tests
# File: perf.pl
# Description: lognit performance tests
# this script outputs a csv file with metrics
# Usage: perl perf.pl
# Dependencies (binaries): jmap, pidstat
# Notes: Tested under perl 5.12.4
use feature qw(say);
use IO::Handle;
@cathoderay
cathoderay / test_inpect_shell.py
Created December 11, 2011 23:27
inspect_shell test
"""
Testing inspect_shell from https://github.com/amoffat/Inspect-Shell
1. execute this script;
2. execute inspect_shell.py
3. call f() from inpect_shell.py
4. asserts that the outputs in the original program changes, =)
"""
import inspect_shell
@cathoderay
cathoderay / gist:1462578
Created December 11, 2011 20:30
disabling touchpad
sudo synclient TouchPadOff=1 #0 for enabling
@cathoderay
cathoderay / gist:1441320
Created December 7, 2011 03:31
csv ploting from R
plot(read.csv('file.csv'), type="o", col="blue")
@cathoderay
cathoderay / my-time
Created November 27, 2010 16:34
modification of time (core) function to return the elapsed time in float, instead of formated string.
(defn my-time
"This is a construction above core 'time' function to
return the time elapsed as a float, instead of a formated string.
Usage example: (my-time + 2 1)"
[f & args]
(Float/parseFloat (first (re-find #"(\d+\.\d+)" (with-out-str (time (apply f args)))))))
(doseq [url (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))] (println (.getFile url)))