Skip to content

Instantly share code, notes, and snippets.

View tldrafael's full-sized avatar

Rafael Toledo tldrafael

View GitHub Profile
@mortie
mortie / fan-speed-control.service
Last active February 4, 2022 01:49
Better Dell fan speed control
# Copy fan-speed-control.sh to `/usr/local/bin/fan-speed-control.sh`,
# make sure it's executable with `sudo chmod +x /usr/local/bin/fan-speed-control.sh`.
# Then copy this file `/lib/systemd/system/fan-speed-control.service`,
# then run `sudo systemctl enable --now fan-speed-control`.
# Check that everything looks OK with `sudo journalctl -fe -u fan-speed-control`.
[Unit]
Description=Fan speed control
[Service]
@adioshun
adioshun / centroidtracker.py
Created August 13, 2018 05:51
Simple object tracking with OpenCV
# https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/
# import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
class CentroidTracker():
def __init__(self, maxDisappeared=50):
# initialize the next unique object ID along with two ordered
@bzamecnik
bzamecnik / installing_cuda_on_azure_nc_tesla_k80_ubuntu.md
Last active January 18, 2022 21:13
Installing NVIDIA CUDA on Azure NC with Tesla K80 and Ubuntu 16.04
@ivanleoncz
ivanleoncz / flask_app_logging.py
Last active May 23, 2021 07:25
Demonstration of logging feature for a Flask App.
#/usr/bin/python3
""" Demonstration of logging feature for a Flask App. """
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
__author__ = "@ivanleoncz"
import logging
@RamonGilabert
RamonGilabert / bluetooth.sh
Last active October 12, 2023 18:24
Bluetoothctl automation
#!/usr/bin/expect -f
set prompt "#"
set address [lindex $argv 0]
spawn sudo bluetoothctl -a
expect -re $prompt
send "remove $address\r"
sleep 1
expect -re $prompt
@MarkusHackspacher
MarkusHackspacher / webserver.py
Created April 3, 2015 11:44
Python Webserver GUI
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Webserver für Python
03.01.2014 MH Quelltext für Python 2.7 und 3.x
30.05.2013 MH Quelltext nach PEP8 überprüft
http://creativecommons.org/licenses/by-nc-sa/3.0/de/
"""
try:
import Tkinter as tk
@jbonney
jbonney / spotify_keybindings
Created June 9, 2013 13:22
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@devoncrouse
devoncrouse / clean_audio.sh
Created May 7, 2013 17:02
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@shunsukeaihara
shunsukeaihara / cc.py
Created January 23, 2013 08:45
some of color correction algorithm in python
# -*- coding: utf-8 -*-
import numpy as np
import Image
import sys
def from_pil(pimg):
pimg = pimg.convert(mode='RGB')
nimg = np.asarray(pimg)
nimg.flags.writeable = True
return nimg