Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / README.md
Created April 24, 2021 18:16
How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

Cgroups is a flexible Linux kernel feature to limit, police and account resources usage. A cgroup is a set of tasks for a subsystems, that is typically a resource controller.

A file system of type cgroup is mounted and all operations are run over it.

Installation

The installation can be done using any of libcgroup, cgmanager or systemd.

@samthecodingman
samthecodingman / bookmarklet-gtranslate.js
Last active October 25, 2018 10:37
Reload the current page in Google Translate (English) [Javascript Bookmarklet] [CC-BY License]
javascript:(window.location.href.indexOf("translate.google.com")>-1)?((new%20RegExp('[?&]u=([^&]*)')).exec(location.search)!=null)?window.location.assign("https://translate.google.com/translate?hl=en&sl=auto&tl=en&sandbox=1&u="+(new%20RegExp('[?&]u=([^&]*)')).exec(location.search)[1]):alert("Error:%20This%20google%20translate%20page%20does%20not%20have%20a%20url%20parameter."):window.location.assign("https://translate.google.com/translate?hl=en&sl=auto&tl=en&sandbox=1&u="+encodeURIComponent(window.location.href));
@Grayson
Grayson / reeder-opml.py
Created April 11, 2014 18:24
Import OPML into Reeder-Mac
import os
import shutil
import sqlite3
from sys import argv
from xml.dom.minidom import parse
def dom_element_to_insert(elem):
return (elem.getAttribute('xmlUrl'),elem.getAttribute('text'), elem.getAttribute('title'), elem.getAttribute('htmlUrl'))
def main(path_to_opml):
@echristopherson
echristopherson / macvim.rb
Created November 19, 2012 03:54
macvim-with-breakindent-patch.rb
require 'formula'
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
url 'https://github.com/b4winckler/macvim/tarball/snapshot-65'
version '7.3-65'
sha1 'fa5f6e0febe1ebcf5320a6ff8bcf4c7e39eccf8e'
head 'https://github.com/b4winckler/macvim.git', :branch => 'master'
@hurricanerainbow
hurricanerainbow / gist:3422129
Created August 22, 2012 03:47
PHP Short Tag Removal
replace "<\?=\$(.*)\?>" to "<?php echo \$\1; ?>"
and then "<\?(?!php)" to "<?php"
@sjl
sjl / Menlo-ForPowerline.ttc.zip
Created January 17, 2012 18:09
Patched Menlo for Powerline. This one includes the bold, italic, etc variants.
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt