Skip to content

Instantly share code, notes, and snippets.

View timkofu's full-sized avatar
💭
💭

Timothy Makobu timkofu

💭
💭
View GitHub Profile
@never_cache
def caesar_decrypt(request):
def caesar_shift(crypt_text):
table = string.maketrans(
string.ascii_lowercase,
string.ascii_lowercase[13:]+string.ascii_lowercase[:13])
return string.translate(crypt_text.encode(errors="ignore").lower(), table)
if request.method == 'POST':
#!/bin/bash
# Tell the kernel you want to use this machine as an IP V4 gateway
echo 1 > /proc/sys/net/ipv4/ip_forward
# Set up variables for the network interfaces
lan_interface=eth0
internet_interface=eth1
# Ports you want your users to connect directly to on the internet
@timkofu
timkofu / Jobs Google search
Last active December 18, 2015 11:08
Jobs Google search
@timkofu
timkofu / gist:6989837
Last active December 25, 2015 14:19
Dell Poweredge T620 Specs
Vendor: Dell Inc.
Version: 1.5.3
Release Date: 03/12/2013
BIOS Revision: 1.5
CPU information
Machine class: amd64
CPU Model: Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz
No. of Cores: 12
@timkofu
timkofu / pf.conf
Last active March 1, 2022 12:34
FreeBSD transparent proxy with PF + Squid
# Squid should be intercepting on port 2600
# A cachaing dns server should be running on this box, with squid and clients all resolving through it.
# FreeBSD 9.2 RELEASE + Squid 3.3.9 from ports
# Timothy Makobu, 2013
# Variables
admin_if = "igb0"
external_if = "igb1"
intraservices = "{ 22, 2600, 53 }"
forward_ports = "{ 443, 465, 6667, 22, 587, 5938, 2083, 2082, 2095, 2096, 5242, 4244, 5243, 9785 }"
import requests
from bs4 import BeautifulSoup
from num2words import num2words
import time
import subprocess
import re
import random
maxlen = 31
@timkofu
timkofu / Django filter column overflow scrollbar.css
Last active March 7, 2017 05:42
Django filter column overflow scrollbar. Override /django/contrib/admin/static/admin/css/changelists.css
#changelist-filter {
position: absolute;
top: 0;
right: 0;
z-index: 1000;
width: 160px;
height: 100%;
border-left: 1px solid #ddd;
background: #efefef;
margin: 0;
@timkofu
timkofu / sema.py
Last active November 3, 2015 08:33
Python code to send SMS via the Sematime API
# Code to send SMS via the Sematime API
# API Doc: https://s3.amazonaws.com/api.sematime.com/Sematime+API+Docs.pdf
import json
import requests
def send_message(recipients, message):
user_id = "" # your user id
@timkofu
timkofu / 202020.py
Last active February 29, 2016 19:39
Code to help with sticking to the 20-20-20 rule.
# Combat Computer Vision Syndrome using the 20-20-20 rule
# Every 20 minutes, spend 20 seconds looking at something 20 feet away, minimum.
# https://www.vsp.com/computer-vision-syndrome.html
# @timkofu, 2016
import subprocess
import time
import sys
# Keeps heroku free dyno from sleeping
# Runs from cron every 29 minutes
import requests
import gevent
from gevent import monkey
monkey.patch_all()