Skip to content

Instantly share code, notes, and snippets.

@classilla
classilla / lvds.sh
Created June 8, 2019 06:57
Modified /usr/bin/lvds.sh to enable S/PDIF over HDMI on the Raptor Blackbird (with thanks to @madscientist159).
#!/bin/bash
#
# Copyright 2018 - 2019 Raptor Engineering, LLC
# Released under the terms of the GPL v3
# ***** BMC PINMUX *****
# HACK
# Work around pinmux hog failure on cold boot
# Remove this block once the pinmux is fixed in the kernel!
@yayMark
yayMark / add_bootstrap_control_class.php
Created September 5, 2018 05:48
Apply Bootstrap 4 custom checkboxes and radio buttons to Gravity Fields generated forms
<?php
// Apply Bootstrap 4 custom checkboxes and radio buttons to Gravity Fields generated forms
// Derived from https://jayhoffmann.com/using-gravity-forms-bootstrap-styles/
add_filter( 'gform_field_container', 'add_bootstrap_control_class', 10, 6 );
function add_bootstrap_control_class( $field_container, $field, $form, $css_class, $style, $field_content ) {
$id = $field->id;
$field_id = is_admin() || empty( $form ) ? "field_{$id}" : 'field_' . $form['id'] . "_$id";
@hopeseekr
hopeseekr / docker_dedicated_filesystem.md
Created February 3, 2018 04:01
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@ajvillegas
ajvillegas / get-attachment-details.php
Last active August 12, 2018 04:12
Illustrates how to extract attachment details returned by wp_prepare_attachment_for_js().
<?php
/**
* Illustrates how to extract attachment details returned by wp_prepare_attachment_for_js().
*
* The wp_prepare_attachment_for_js() function returns an array with the attachment post object
* that can be used to extract specific information for the attachment.
*
* Following is a list of all the details that the function returns extrated into individual variables.
*
@Tynach
Tynach / telegram-gif.sh
Last active July 3, 2023 10:33
Uses FFMPEG to convert any file FFMPEG understands into a .mp4 file that Telegram will consider as a 'gif', at higher quality than Telegram converts gifs to itself.
#!/bin/bash
# Settings
outfolder="converted"
codec="libx264"
maxres="448"
#filter="crop=floor(in_w/2)*2:floor(in_h/2)*2:0:0:exact=1,colorspace=bt601-6-625:range=pc:irange=tv:iall=bt601-6-625:format=yuv444p12,zscale=rin=full:tin=601:t=linear,scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)),zscale=rin=full:r=limited:tin=linear:t=601"
filter="scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)):out_color_matrix=bt601:out_range=tv:flags=accurate_rnd+full_chroma_inp+full_chroma_int+bicublin"
preset="veryslow"
profile="high"
## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
@louim
louim / uploads.yml
Last active December 23, 2022 14:20
Drop-in playbook for Trellis to push and pull uploads from the server to your local machine.
---
- name: Sync uploads between environments
hosts: web
remote_user: "{{ web_user }}"
vars:
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
tasks:
@khromov
khromov / cpt-remove-front.php
Last active December 22, 2016 15:01
WordPress - Remove the front permastruct / base slug from a custom post type (CPT)
<?php
class Plugin
{
/**
* This will let a CPT with the slug 'story' be used without a base slug, ie:
* Before:
* /story/hello
*
* After:
* /hello
@tacensi
tacensi / ACF Options page as submenu
Created January 16, 2015 16:51
Put the options page inside another WP menu (posts, pages, etc.)
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(
array(
'title' => 'Destaques',
'parent' => 'edit.php',
'capability' => 'publish_posts'
)
);
}
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html