Skip to content

Instantly share code, notes, and snippets.

View codemedic's full-sized avatar
🙂
🙃

Dino Korah codemedic

🙂
🙃
View GitHub Profile
@codemedic
codemedic / README.md
Created June 24, 2016 13:50 — forked from mmoulton/README.md
Docker Container Stats Collection Using Collectd

Docker stats collection for collectd

This script can be used to feed collectd with cpu and memory usage statistics for running docker containers using the collectd exec plugin.

This script will report the used and cached memory as well as the user and system cpu usage by inspecting the appropriate cgroup stat file for each running container.

Usage

This script is intented to be executed by collectd on a host with running docker containers. To use, simply configure the exec plugin in collectd to execute the collectd-docker.sh script. You may need to adjust the script to match your particulars, such as the mount location for cgroup.

Rate limiting with Redis

June 2011 - Chris O'Hara - (archived original post)

Rate limiting can be an effective way of conserving resources and preventing automated or nefarious activities on your site.

A common use case is to limit the amount of requests an IP can make over a certain time frame. For example, you might want to restrict users from using an expensive search utility on your site. If the user attempts to search more than 5 times a minute, you can redirect them to another page informing them that they need to wait.

IP based rate limiting is already in use on larger sites. Google and Yahoo both employ the technique to prevent (or at least complicate) automated requests to their services.

@codemedic
codemedic / FontFix RubyMine
Created January 8, 2016 13:53 — forked from leemour/FontFix RubyMine
Fixing font anti-aliasing for Ubuntu.
# Change Java Runtime:
sudo update-alternatives --config java
# Delete Open-JDK
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
# Change fonts - remove hinting:
http://askubuntu.com/questions/32624/ugly-fonts-in-netbeans-how-can-i-make-it-use-the-system-font
# Change RubyMine AntiAliasing first:
@codemedic
codemedic / check_docker_container.sh
Created January 5, 2016 18:45 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# The script checks if a container is running.
# OK - running
@codemedic
codemedic / VirtualBoxKickstart.md
Created December 7, 2015 16:01 — forked from jtyr/VirtualBoxKickstart.md
How to use kickstart in VirtualBox

How to use kickstart in VirtualBox

This short howto describes how to install VMs via kickstart in VirtualBox. It's using PXE functionality built into the NAT network mode of the VirtualBox. The following instructions apply to CentOS installation but it should work for any RedHat-based distro.

Prepare directory structure

@codemedic
codemedic / jquery.stoc.js
Last active August 29, 2015 14:27 — forked from goldsky/jquery.stoc.js
jQuery Plugin: Table of Contents with Smooth Scrolling
/**
* jQuery Plugin: Table of Contents with Smooth Scrolling
* @link http://www.1stwebdesigner.com/css/jquery-plugin-smooth-scrolling/
* @author Rochester Oliveira
*/
(function($){
$.fn.stoc = function(options) {
//Our default options
var defaults = {
@codemedic
codemedic / konsole-with-palette-colours.css
Last active July 14, 2023 13:56
CSS for KDE Konsole minimal, lighter, dark tabs
QTabBar,
QTabBar::tab
{
font-family: "Noto Sans";
font-size: 11px;
height: 16px;
padding: 2px;
border: 0px;
border-bottom: 3px solid palette(dark);
background-color: palette(dark);
@codemedic
codemedic / .fonts.conf
Last active August 29, 2015 14:08 — forked from odony/.fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Documented at
http://linux.die.net/man/5/fonts-conf
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok, n1xim, pennedav, kabel)
Version: 0.2.0
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.2.0 0000-00-00 Updated page layout/styles and restructure code to be more MVC-like (kabel)
implemented HTTP Basic authentication (pennedav)
<?php
// Crude check. Off course this should be stored in a (memory) database. $token is an
// access token that is provided by oauth.
$token = $_SERVER['HTTP_X_AUTH_TOKEN'];
if ($token == "mellon") {
header("X-Api-User: Gandalf");
header("X-Api-Context: Middle-Earth");
header("Cache-Control: public, max-age=120");