Skip to content

Instantly share code, notes, and snippets.

View oscarotero's full-sized avatar
Beautiful, open and accessible web

Óscar Otero oscarotero

Beautiful, open and accessible web
View GitHub Profile
@mjackson
mjackson / color-conversion-algorithms.js
Last active June 8, 2024 01:27
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
# Undo latest commit
git reset --soft HEAD^
# Undo the changes of a commit (creating a new commit)
git revert <commit>
# Undo latest merge (before push)
git reset --merge ORIG_HEAD
# Merge a branch using the version of the current branch in case of conflicts
@Vestride
Vestride / encoding-video.md
Last active June 5, 2024 14:38
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@eusonlito
eusonlito / backup-mysql.sh
Last active June 26, 2023 04:25
Automate your MySQL backups
#!/bin/bash
# -------------------------------------
# Databases backup with X days storage history
#
# User executing this script must have FULL permissions
# to mysql and mysqldump
#
# Use $HOME/.my.cnf to store MySQL auth
#
@oscarotero
oscarotero / oom.html
Last active August 9, 2016 08:30
Selo para as webs.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
███████
██████▌
▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄ ██████
▄███████████▄ ▄███████████▄ ▐█████▄███████▄▄███████▌ █████▌
▄██████▀ ▀████████████▀ ▀████████████▀▀███████▀▀███████ █████
@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@oscarotero
oscarotero / Instruccións.md
Last active July 20, 2016 18:18
Intruccións para instalar un servidor

Instalación dun servidor

1. Preparación básica

# Actualización de paquetes
apt-get update
apt-get upgrade

# Instalación doutros paquetes
@oscarotero
oscarotero / Utils.md
Last active November 5, 2019 15:50
Links utiles
@eusonlito
eusonlito / local-backup.sh
Last active June 26, 2023 04:25
Easy backup script into a local computer
#!/bin/bash
# -------------------------------------
# Script to do incremental rsync backups
# into a local computer
#
# This script is freely distributed under the GPL
# -------------------------------------