Skip to content

Instantly share code, notes, and snippets.

# When service supervisor->supermann uses more than 500Mb of RSS, restart it
- when: service(supermann).rss > 500Mb,
then: restart service supermann
# When the first partition has less than 1Gb of space remaining, stop the 'leak' service
- when: partition(sda1).space_remaining < 1Gb
then: disable service mannhunter
import functools
def catch_me_if_you_can(*types):
def wrapper(function):
@functools.wraps(function)
def decorator(*args):
try:
return function(*args) + amount_to_add
except types as e:
print("lol", e)
| en | English | English |
| en-Scouse | Scouse | Scouse |
| en-au | Australian | Australian |
| en-lol | LOLCAT | LOLCAT |
| en-old | Old English | Englisc |
| en-pirate | Pirate | Pirate |
| en-tx | Texan | Texan |
| cy-GB | Welsh | Cymraeg |
def unforce_ssl
if request.ssl?
redirect_to protocol: 'http://', port: NON_SSL_PORT
end
end
bower@1.3.12 node_modules/bower
├── is-root@1.0.0
├── junk@1.0.0
├── stringify-object@1.0.0
├── which@1.0.5
├── abbrev@1.0.5
├── chmodr@0.1.0
├── osenv@0.1.0
├── opn@1.0.0
├── archy@0.0.2
def ijz(x, y):
x = str(x)
for i in range(len(x)):
n = int(x[i:])
if n < y:
return n
assert ijz(12345, 50) == 45
assert ijz(123789, 50) == 9
$ sudo aptitude remove cowsay
The following packages will be REMOVED:
cowsay
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 90.1 kB will be freed.
The following packages have unmet dependencies:
mint-meta-core : Depends: cowsay but it is not going to be installed.
mintsystem : Depends: cowsay but it is not going to be installed.
The following actions will resolve these dependencies:
>>> [].flatten!
=> nil
>>> [[1], [2]].flatten!
=> [1, 2]
>>> [[1]].flatten!
=> [1]
>>> [[]].flatten!
=> []
>>> [].flatten!
=> nil
bower@1.3.8 /usr/local/lib/node_modules/bower
├── is-root@0.1.0
├── junk@0.3.0
├── stringify-object@0.2.1
├── which@1.0.5
├── abbrev@1.0.5
├── chmodr@0.1.0
├── osenv@0.1.0
├── opn@0.1.2
├── archy@0.0.2
@borntyping
borntyping / run_sleep.sh
Created June 26, 2014 15:45
exec + ulimit example
❯ ./set_ulimit.sh
14569 unlimit: 1024
14569 unlimit: 69
14569 unlimit: 69 (exec)