Skip to content

Instantly share code, notes, and snippets.

View smrchy's full-sized avatar

Patrick Liess smrchy

View GitHub Profile
@smrchy
smrchy / app.js
Created February 11, 2020 14:34 — forked from tj/app.js
const http = require('http')
const rpc = require('./rpc')
/**
* Pets service.
*/
class Pets {
constructor(db = []) {
#host running out of memory!
ALERT HighMem
IF 100 -(node_memory_MemFree + node_memory_Buffers + node_memory_Cached) / node_memory_MemTotal* 100 > 80
FOR 1m
WITH {
severity="page"
}
SUMMARY "Instance {{$labels.host}} has high memory consumption"
DESCRIPTION "{{$labels.host}} of job {{$labels.job}} has less than 40% of memory available for more than 1 minutes."
@smrchy
smrchy / helpers.sh
Created February 10, 2016 13:31 — forked from mpneuried/cron.sh
bash helpers
# SYSTEM: open a file as admin with a special app
sudo open -a /Applications/Utilities/Console.app/ /usr/local/mysql/data/Mathiass-iMac.log
# SYSTEM: Create a symbolic link
ln -s /Path/to/original/folder New-folder-name
# SYSTEM: show long running clock
clear; while true; do echo -e \\b\\b\\b\\b\\b\\b\\b\\b`date +%T`\\c ; sleep 1; done
# SYSTEM: Set ENV var
@smrchy
smrchy / nginx-openresty-ubuntu-build-dependencies.sh
Last active September 24, 2015 12:35 — forked from markselby/nginx-openresty-ubuntu-build-dependencies.sh
Build Nginx OpenResty version on Ubuntu.This is part of the high performance caching blog on writebox.co.uk
# Build dependencies for OpenResty.
sudo apt-get install build-essential libpcre3-dev libssl-dev libgeoip-dev
# Install standard Nginx first so that you get the relevant service scripts installed too
sudo apt-get install nginx
# If you want to access Postgres via Nginx
sudo apt-get install libpq-dev
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
# -*- coding: utf-8 -*-
"""
amazon_sender.py
~~~~~~~~
Python helper class that can send emails using Amazon SES and boto.
The biggest feature of this class is that encodings are handled properly.
It can send both text and html emails.
This implementation is using Python's standard library (which opens up for a lot more options).
@smrchy
smrchy / gist:3414678
Created August 21, 2012 11:23 — forked from lucasfais/gist:1207002
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
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@smrchy
smrchy / hack.sh
Created March 31, 2012 11:53 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#