Skip to content

Instantly share code, notes, and snippets.

View salicio's full-sized avatar

Roberto Salicio salicio

  • Linube
  • Barakaldo, Spain
View GitHub Profile
<?php
/**
* AMP Enable SSR
*
* @package AMP_Enable_SSR
* @author Weston Ruter, Google
* @link https://gist.github.com/westonruter/8d52c0b807e6dfbbdf2219622d0f4a7e
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@iscott
iscott / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Last active May 22, 2024 08:00
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 6 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4, 5, or 6
@sroze
sroze / MyCommand.php
Last active June 6, 2021 13:58
Symfony Command that read file from file name or STDIN
<?php
namespace AmceBundle\Command;
class MyCommand
{
// ...
protected function execute(InputInterface $input, OutputInterface $output)
{
@protrolium
protrolium / ffmpeg.md
Last active July 12, 2024 17:37
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@nwjlyons
nwjlyons / back lit keyboard linux
Last active February 24, 2024 16:18
Turn Mac Book Pro backlit keyboard on and off under linux
# First su in as root
sudo su
# Then cd to backlight directory
cd /sys/class/leds/smc::kbd_backlight/
# Turn the backlight on
cat max_brightness > brightness
# Set to zero to turn off the backlight
@dimsemenov
dimsemenov / vcl-regex-cheat-sheet
Last active March 12, 2022 19:01
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@lisamelton
lisamelton / transcode-video.sh
Last active May 24, 2024 17:42
Transcode video file (works best with Blu-ray or DVD rip) into MP4 (or optionally Matroska) format, with configuration and at bitrate similar to popular online downloads.
#!/bin/bash
#
# transcode-video.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 5.13 of April 8, 2015
function vec3(xx, yy, zz) {
this.x = xx || 0;
this.y = yy || 0;
this.z = zz || 0;
this.translate = function (d) { return new vec3(this.x+d[0], this.y+d[1],this.z+d[2]) }
this.scale = function(s) { return new vec3(s*this.x, s*this.y,s*this.z) }
this.rotz = function(ang) {
var c = Math.cos(ang)
var s = Math.sin(ang)
return new vec3(this.x*c - this.y*s,this.y*c + this.x*s, this.z)
@shrop
shrop / brewStack.md
Last active October 11, 2023 20:18
brewStack Docs