Skip to content

Instantly share code, notes, and snippets.

View k0nsl's full-sized avatar
🎯
Focusing

k0nsl k0nsl

🎯
Focusing
View GitHub Profile
anonymous
anonymous / fawk
Created November 21, 2014 21:59
A Bash shell function to save your fingers from typing "awk '{ print $5 }'" all the time
# Inspiration: http://serverfault.com/a/5551 (but basically rewritten)
function fawk() {
USAGE="\
usage: fawk [<awk_args>] <field_no>
Ex: getent passwd | grep andy | fawk -F: 5
"
if [ $# -eq 0 ]; then
echo -e "$USAGE" >&2
return
#exit 1 # whoops! that would quit the shell!
@chrisboulton
chrisboulton / ip_blacklist.lua
Last active April 2, 2024 10:43
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@ecampidoglio
ecampidoglio / cpustatus.sh
Created February 21, 2013 23:42
A Bash script that prints the current state of the CPU on a Raspberry Pi. It displays variables like temperature, voltage and speed.
#!/bin/bash
# cpustatus
#
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
@0x9900
0x9900 / dnstest.py
Last active February 15, 2017 20:07
Quick and dirty speed test for public DNS services.
#!/usr/bin/env python
#
import DNS
import time
import sys
from collections import defaultdict
services = {
#'local': ['192.168.10.1'],
@JimWestergren
JimWestergren / index-with-redis.php
Last active February 11, 2023 18:28
Redis as a Frontend Cache for WordPress
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
@blHdIjbJ
blHdIjbJ / massrbl.php
Created January 28, 2012 21:24
simple mass RBL check
<?php
function rblcheck($host) { // Note: I have no idea how well suited CBL is for this purpose. If it gets annoying we can remove it ~ Aurora
$rbls = array('sbl-xbl.spamhaus.org', 'rbl.efnet.org', 'cbl.abuseat.org', 'dnsbl.dronebl.org');
foreach($rbls as $rbl) {
$lookup = implode('.', array_reverse(explode('.', $host))) . '.' . $rbl;
if (strstr(gethostbyname($lookup), "127.0.0")) {
return $rbl;
}
}
return 0;