Skip to content

Instantly share code, notes, and snippets.

View dannofx's full-sized avatar

Daniel Heredia dannofx

  • Monterrey, MX
View GitHub Profile
{
"version": 1,
"variables": [{
"names": ["id", "date", "text"] ,
"values": [
@dannofx
dannofx / cbz compresser
Last active September 21, 2017 18:23
Compress easch subdirectoryinside a directory to a cbz file
#!/bin/bash
if [ -z "$1" ]
then
echo "Specify the source directory."
echo "./joincbr.sh SOURCE_DIRECTORY"
exit 0
fi
SOURCE_DIRECTORY=$1
@dannofx
dannofx / Utils.swift
Created August 2, 2017 04:29
Extension to force load of UIImage and avoid lazy load in Swift 3
// Based on https://gist.github.com/steipete/1144242
import UIKit
extension UIImage {
func forceLoad() -> UIImage {
guard let imageRef = self.cgImage else {
return self //failed
}
@dannofx
dannofx / joincbzr.sh
Last active October 6, 2017 17:37
Join several cbr or cbz files within in one single big cbz file, the order of the files in the final file will be determined alphabetically.
#!/bin/bash
if [ -z "$1" ]
then
echo "Specify the name of the file to create and the directory with the cbr files."
echo "./joincbr.sh YOUR_COMIC_FILE SOURCE_DIRECTORY"
exit 0
fi
TARGET_NAME=$1
@dannofx
dannofx / clipboard_watcher.sh
Created March 16, 2017 04:11
macOS: Watches the content of the clipboard every 0.5 seconds and print it out to the general output.
#!/bin/bash
LAST_TEXT=
while :
do
CURRENT_TEXT=`pbpaste`
if [ "$LAST_TEXT" != "$CURRENT_TEXT" ]
then
echo $CURRENT_TEXT
@dannofx
dannofx / scrap_magnet.py
Last active May 16, 2022 12:06
Parse a list of links from eztv, extract the magnet links and format the output to use it with transmission-remote
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import sys
def scrap_magnet(url):
try:
html = requests.get(url)
soup = BeautifulSoup(html.text, 'html.parser')
@dannofx
dannofx / ovpngen.sh
Last active February 16, 2017 02:03
OVPN: Generation of certificates, keys and profiles for clients.
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage:"
echo "Generate profile:"
echo "sudo ./ovpngen.sh your_profile_name"
echo "Revoke profile:"
echo "sudo ./ovpngen.sh -r your_profile_name"
exit 0