Skip to content

Instantly share code, notes, and snippets.

View Bash best practices
# Bash best practices and style-guide
Just simple methods to keep the code clean.
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/).
## Quick big rules
* All code goes in a function
* Always double quote variables
@ursm
ursm / len0073.patch
Last active Jan 31, 2020
Fix TrackPoint / touchpad issue on ThinkPad X1 Carbon 5th (Linux 4.12)
View len0073.patch
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 16c3046..ca912ce 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -173,6 +173,7 @@ static const char * const smbus_pnp_ids[] = {
"LEN0046", /* X250 */
"LEN004a", /* W541 */
"LEN200f", /* T450s */
+ "LEN0073", /* X1 Carbon 5 (Elantech) */
NULL
@DaveyJake
DaveyJake / Wordpress RSS 2.0 image enclosure [COMPLETE with IMG filesize included].php
Last active Sep 7, 2020 — forked from supermethod/Wordpress RSS 2.0 image enclosure
How to add an enclosure to a wordpress RSS feed using the first image of the post [with its actual length attribute value] - add to functions.php
View Wordpress RSS 2.0 image enclosure [COMPLETE with IMG filesize included].php
<?php
/**
* Wordpress RSS 2.0 image enclosure.
*
* @param WP_Query $query The current WP_Query instance.
* @return WP_Query
*/
add_filter( 'pre_get_posts', 'feed_filter' );
function feed_filter( $query ) {
if ( $query->is_feed ) {
@XVilka
XVilka / TrueColour.md
Last active Feb 24, 2021
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@KartikTalwar
KartikTalwar / Documentation.md
Last active Feb 14, 2021
Rsync over SSH - (40MB/s over 1GB NICs)
View Documentation.md

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@jonraasch
jonraasch / jQuery.support-transition.js
Created Apr 21, 2010
Extends the jQuery.support object to CSS3 transition
View jQuery.support-transition.js
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
return support;
})();