Skip to content

Instantly share code, notes, and snippets.

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

Rafael dos Santos Silva xfalcox

🏠
Working from home
View GitHub Profile
@devadvance
devadvance / .bashrc
Created February 28, 2021 20:31
Convenient ffmpeg shell functions
#######################################
# Displays a yes/no prompt to continue that repeats until input matches.
# Arguments:
# $1 - (optional) a string representing the yes/no question to ask
# $2 - (optional) a string representing the prompt style.
# Returns:
# 0 to proceed further (indicates "yes"), 1 to stop (indicates "no").
#######################################
continue_prompt() {
local prompt default reply
@irvingpop
irvingpop / ssh_key.tf
Last active April 8, 2024 07:18
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@tomfuertes
tomfuertes / http2-server-push.rb
Last active February 2, 2019 19:32
Rails HTTP2 Server Push via Header Link (on Cloudflare)
class ApplicationController < ActionController::Base
after_action :server_push_headers # https://twitter.com/connorjshea/status/728472354385317888
def server_push_headers
# CLoudflare HTTP2 Server Push: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/
if request.format.html? # only on html pages
layout = self.send(:_layout) # with the right layout
if layout == "main" || layout == "speaker" || layout == "admin"
assets = [
@welsh
welsh / README.md
Last active November 2, 2020 18:05
Server Status Squares: A Dashing Dashboard Widget to represent a Server Status as a Colored Square.

Server Status Squares

A Dashing widget that checks whether a server is responding to either an http or ping request using smaller squares to represent its status.

This is based off of the Server Status widget that willjohnson developed but modified to work across multiple squares rather than be one square with a list.

Description

The widget updates the appropriate squares color upon determining its status. Statuses are as follows:

@guifromrio
guifromrio / compress-pdf-with-gs.md
Created August 30, 2013 14:39
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@ImBobby
ImBobby / gist:5996847
Last active December 25, 2018 18:54
Paper style browser notepad
data:text/html, <html spellcheck="false" contenteditable> <style> html,body{min-height: 100%} body {min-height: 100%; background-color: transparent; background-image: -webkit-linear-gradient(top, #ddd 2%, transparent 2%); background-image: -moz-linear-gradient(top, #ddd 2%, transparent 2%); background-image: -o-linear-gradient(top, #ddd 2%, transparent 2%); background-image: linear-gradient(to bottom, #ddd 2%, transparent 2%); background-size: 100% 1.5em; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; color: #333; display: block; font: normal 1.5em 'Cambria', georgia, serif; height: 100%; line-height: 1.5em; margin: 0 auto; padding: .2em .5em; position: relative; vertical-align: bottom; width: 80%; } body:before, body:after{ content: ''; position: absolute; left: 0; top: 0; width: 100%; min-height: 100%; background: transparent; z-index: -1; } body:before{ background-image: -webkit-linear-gradient(left, #ccc 5px, transparent 5px, transparent 100%); background-image: -moz-
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 21, 2024 15:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a