Skip to content

Instantly share code, notes, and snippets.

@ryin
ryin / tmux_local_install.sh
Last active October 2, 2024 14:23
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@awidegreen
awidegreen / vim_cheatsheet.md
Last active October 27, 2024 12:13
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@Infocatcher
Infocatcher / dontRememberClosedNewTabs.js
Last active December 11, 2015 13:48
Don't save closed "about:newtab" tabs in undo close history. Only tabs without back/forward history will be removed. You can create Custom Button with this code in initialization.
addEventListener("TabClose", function(e) {
function isNewTabURL(url) {
// See chrome://browser/content/utilityOverlay.js
return url == (window.BROWSER_NEW_TAB_URL || "about:newtab");
}
var tab = e.target;
var browser = tab.linkedBrowser;
if(!isNewTabURL(browser.currentURI.spec))
return;
var sh = browser.sessionHistory;
var TU_hookCode = TU_hookMethod;
function TU_hookMethod(aStr) {
try {
var namespaces = aStr.split(".");
try {
var object = this;
while (namespaces.length > 1) {
object = object[namespaces.shift()];
}
@Infocatcher
Infocatcher / increaseDownloadCount.js
Last active December 16, 2015 05:49
Firefox: increase item count in built-in download panel(browser.download.useToolkitUI = false)
// https://gist.github.com/Infocatcher/5387328
// More: https://github.com/Infocatcher/Download_Panel_Tweaker
// (c) Infocatcher 2013, 2015
var itemCountLimit = 5;
// resource://app/modules/DownloadsCommon.jsm, see getSummary() function
if(DownloadsCommon._privateSummary)
DownloadsCommon._privateSummary._numToExclude = itemCountLimit;
if(DownloadsCommon._summary)
DownloadsCommon._summary._numToExclude = itemCountLimit;
@maestrith
maestrith / Imgur_Upload.ahk
Last active December 19, 2015 10:59
Upload an image to Imgur: Instructions Below:
#SingleInstance,force
Menu,Tray,Add
Menu,Tray,Add,Grab,grab
return
grab:
Hotkey,LButton,select,On
Hotkey,RButton,Select,On
Hotkey,^F1,getinfo,On
return
getinfo:
@denji
denji / nginx-tuning.md
Last active November 5, 2024 10:10
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@Tblue
Tblue / mozlz4a.py
Last active November 6, 2024 19:26
MozLz4a compression/decompression utility
#!/usr/bin/env python3
# vim: sw=4 ts=4 et tw=100 cc=+1
#
####################################################################################################
# DESCRIPTION #
####################################################################################################
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
@mikejolley
mikejolley / gist:9f5adb8d194d7681e7b7
Last active April 18, 2023 22:49 — forked from corsonr/gist:6681929
WooCommerce - Create a product categories dropdown list in a shortcode
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Register a shortcode that creates a product categories dropdown list
*
* Use: [product_categories_dropdown orderby="title" count="0" hierarchical="0"]
*/
@mikejolley
mikejolley / gist:e73f9d061aaebd25ccdc
Created February 22, 2016 13:07
WooCommerce - Remove subtotal row.
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals ) {
unset($totals['cart_subtotal'] );
return $totals;
}