Skip to content

Instantly share code, notes, and snippets.

View PHLAK's full-sized avatar
Coffee... always coffee...

Chris Kankiewicz PHLAK

Coffee... always coffee...
View GitHub Profile
@PHLAK
PHLAK / listRepos.php
Last active December 15, 2015 10:49
PHP-CLI script to output a list of repositories (one per line) belonging to the user(s) specified.
#!/usr/bin/php -q
<?php
// Disable errors
error_reporting(0);
foreach ($argv as $user) {
if ($user !== $argv[0]) {
@PHLAK
PHLAK / archive-screenshots.sh
Created February 16, 2013 19:38
Screenshot archiving script.
#!/bin/bash
DAYS=5
# Calculate the threshold value
THRESHOLD=$(($DAYS * 24 * 60 * 60))
# Set current time
TIMESTAMP=$(date +%s)
@PHLAK
PHLAK / .Xmodmap
Created October 25, 2012 19:22
Xmodmod key map for fixing Mac Pro keyboard
! Set key codes
keycode 37 = Control_L
keycode 105 = Control_R
keycode 64 = Super_L
keycode 108 = Super_R
keycode 133 = Alt_L
keycode 134 = Alt_R
keycode 191 = Print
! Clear key modifier mappings
@PHLAK
PHLAK / autoexec.cfg
Last active August 25, 2019 20:25
Custom Dota 2 autoexec.cfg
// -------------------------------------------------------------------------- //
// -----| PERFORMANCE |------------------------------------------------------ //
// -------------------------------------------------------------------------- //
fps_max 200
@panorama_max_fps 200
@panorama_vsync 0
echo "/* ---------------------------------------------------- */"
@PHLAK
PHLAK / BttF.php
Created March 27, 2012 19:25
Back to the Future as code.
<?php
$date = date('M d, Y - h:i A', 499155600); // Oct 26, 1985 - 01:20 AM
$libyans = false;
$speed = 0;
$watts = 1210000000;
while ($libyans == true) {
if ($speed >= 88 && $watts == 1210000000 ) {
@PHLAK
PHLAK / dlCleanup.py
Created March 24, 2012 21:40
Deletes files older than 14 days from a given folder.
import os
import time
path = "E:\\Downloads"
now = int(time.time())
dirList = os.listdir(path)
for fileName in dirList:
filePath = path + "\\" + fileName
<?php
for ($x = 1; $x <= 100; $x++) {
if ($x % 3 === 0 && $x % 5 === 0) {
echo 'FizzBuzz';
} elseif ($x % 3 === 0) {
echo 'Fizz';
} elseif ($x % 5 === 0) {
echo 'Buzz';
@PHLAK
PHLAK / colorful-characters.php
Created July 6, 2011 16:26
Generates random characters with random background and foreground colors.
<?php
function randColor() {
$randDec = rand(0, 16777215);
$randHex = dechex($randDec);
$color = '#' . $randHex;
return $color;
}
@PHLAK
PHLAK / workspace-fsck.sh
Last active March 19, 2020 17:52
Performs fsck and gc on all Git repositories in a given directory.
#!/usr/bin/env bash
set -o errexit pipefail
WORKSPACE=${HOME}/workspace # Path to your workspace
find ${WORKSPACE} -name '.git' -type d | while read LINE; do
pushd "${LINE}/../"
git fsck && git gc
popd
done
@PHLAK
PHLAK / ip-uploader.py
Created February 14, 2011 16:32
Connects to whatismyip.com, obtains your external IP address and uploads a text file containg the IP to a chosen FTP server. Requires Python to run.
#! /usr/bin/env python
import httplib
import sys
import os
import ftplib
# File IP will be output to
file="ip.txt"
# Replace server, user, and password with your login information