Skip to content

Instantly share code, notes, and snippets.

View psykzz's full-sized avatar

Matt psykzz

View GitHub Profile
@ArminBu
ArminBu / main.js
Created August 2, 2019 12:19
This script should replace all absolute alias imports with relative imports. It expects 1 argument for the root directory
const path = require("path");
const args = process.argv;
const rootName = args[2];
const rootPath = path.resolve(process.cwd(), rootName);
const alias = "@";
if (!rootPath || !alias) return;
const { promisify } = require("util");
@davidism
davidism / nest.py
Created June 13, 2014 21:27
Build "path" by accessing attributes and calling
class NestMeta(type):
def __getattr__(cls, key):
return cls(cls, key)
def __str__(cls):
return cls.__name__
__repr__ = __str__
@magemore
magemore / gist:4499587
Created January 10, 2013 04:56
Amazon Linux AMI (Fedora) install htop
# update
sudo yum -y update
sudo yum -y upgrade
# enable EPEL6 by changing enabled=0 -> enabled=1
sudo vim /etc/yum.repos.d/epel.repo
# install htop
sudo yum install htop
@psykzz
psykzz / downloader.class.php
Created September 9, 2012 21:51
Simple rate limited downloader.
<?php
/* *
* @filename downloader.class.php
* @author PsyKzz
* @version 1.0.0
* @description Simple class to rate limit your downloads, while also providing a custom tickrate to combat timeout issues.
* @url http://www.psykzz.co.uk
*
* @license 'WTFPL ' - "Do What The Fuck You Want To Public License".
* This program is free software. It comes without any warranty, to
@ibeex
ibeex / auth.py
Created October 14, 2011 20:04
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@chrisfarms
chrisfarms / xmpplogging.py
Created March 12, 2011 23:35
Python logging handler to send error logs via XMPP/Jabber
from google.appengine.api import xmpp
import logging
import logging.handlers
import os
DEFAULT_FROM_JID = 'logs@%s.appspotchat.com' % os.environ['APPLICATION_ID']
class XmppLogHandler(logging.Handler):
def __init__(self, jid, from_jid):