Skip to content

Instantly share code, notes, and snippets.

View Madh93's full-sized avatar
🏠
Working from home

Miguel Hernández Madh93

🏠
Working from home
View GitHub Profile
@Madh93
Madh93 / Ruby_Proxy_Pattern_And_Metaprogramming.md
Last active December 11, 2020 01:03
Ruby, Proxy Pattern and Metaprogramming

Ruby, Proxy Pattern and Metaprogramming

You have this class:

class BankAccount
  attr_reader :balance

  def initialize(starting_balance = 0)
 @balance = starting_balance
@Madh93
Madh93 / backup.md
Last active February 15, 2017 16:59
Backup: Personal system backup using systemd.

Backup

Personal system backup using systemd.

Installation

  • Copy backup.sh in /usr/local/bin/backup (checkout /usr/local/bin is in $PATH)
  • Copy backup.service in /etc/systemd/system/backup.service
  • Copy backup.timer in /etc/systemd/system/backup.timer

Usage

@Madh93
Madh93 / yt-to-mp3.md
Last active December 16, 2016 07:23
Search and download MP3 from YouTube

yt-to-mp3.rb

Search and download MP3 from YouTube

Requirements

  • Google API Key
  • Ruby (and 'yt' gem)
  • Youtube-dl (and ffmpeg or avconv)
Usage
@Madh93
Madh93 / nvidia-fanspeed.sh
Last active August 16, 2017 17:52
Check temperature and set fan speed value of Nvidia card
#! /bin/bash
#
# nvidia-fanspeed
#
# `nvidia-fanspeed` check temperature and set fan speed value
#
# Requirements: nvidia-xconfig --cool-bits=4
##############################
# Custom configuration:
@Madh93
Madh93 / SyncSubs.md
Last active August 1, 2016 15:59
Sync Subtitles

Sync Subs

Synchronize .srt subtitles

Requirements

  • Ruby
Usage

Usage: ruby syncsubs.rb [options]

@Madh93
Madh93 / http_test.rb
Created June 14, 2016 16:58
Http Test: Download a binary file
#! /usr/bin/env ruby
# NAME : Http Test
# DESCRIPTION : Download a binary file over HTTP
# AUTHOR : Madh93 (Miguel Hernandez)
# VERSION : 0.0.1
# LICENSE : GNU General Public License v3
# USAGE : ruby http_test.rb
require 'open-uri'
@Madh93
Madh93 / VolafileDownloader.md
Last active April 9, 2021 07:07
Volafile Downloader

Volafile Downloader

Get all files from volafile rooms.

Requirements

  • Ruby
  • Selenium
How to install Selenium?
@Madh93
Madh93 / md5test.js
Created June 10, 2016 21:23
MD5 Test
var crypto = require('crypto');
start_time = new Date();
var c = 0;
var m = 10000000;
while (c < m) {
var n0 = Math.floor(Math.random() * 9999999999);
var n1 = Math.floor(Math.random() * 9999999999);
var nn = crypto.createHash('md5').update(n0.toString()+n1.toString()).digest("hex");