Skip to content

Instantly share code, notes, and snippets.

View then3rd's full-sized avatar

Kelie then3rd

View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active May 23, 2024 11:02
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@yosemitebandit
yosemitebandit / ibm_queue.py
Created August 17, 2011 23:28
IBM's python threading example with Queues
#!/usr/bin/python
# -*- coding: utf-8 -*-
import Queue
import threading
import urllib2
import time
hosts = ['http://yahoo.com', 'http://google.com', 'http://amazon.com',
'http://ibm.com', 'http://apple.com']
@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
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@samdoran
samdoran / luks-encrypt-in-place.sh
Last active March 8, 2024 21:17
Encrypt a physical volume using LUKS without erasing the drive.
#!/bin/bash
# Encrypt existing hard drive in place.
# Requires a second physical drive to temporarily store data. This drive will be erased.
# This script is meant to be run on Clonezilla 1.2.9-19 or later.
# The cryptsetup syntax is different in Clonezilla than in Red Hat.
# --- Variables --- #
@initbrain
initbrain / threadqueue_example.py
Created October 17, 2013 11:21
Python thread-safe queue example
#!/usr/bin/env python
from Queue import Queue
from threading import Thread
from urllib2 import urlopen
from re import compile, MULTILINE
from time import time
class ThreadUrl(Thread):
@skarllot
skarllot / iscsiadm.sh
Last active January 2, 2016 02:39
Managing iSCSI into Linux
# Create ifaces
iscsiadm -m iface -I iface0 -o new
iscsiadm -m iface -I iface0
iscsiadm -m iface -o update -I iface0 -n iface.net_ifacename -v eth0
# Discovery
iscsiadm -m discovery -t sendtargets -p 192.168.0.1 -I iface0 -I iface1
# Delete undesired targets
iscsiadm -m node -T iqn.2014-01.com.example:vol0 -p 192.168.0.1 -o delete
@medynski
medynski / fpsMeter.js
Last active February 2, 2024 17:03
JavaScript FPS meter - Calculating frames per second
function fpsMeter() {
let prevTime = Date.now(),
frames = 0;
requestAnimationFrame(function loop() {
const time = Date.now();
frames++;
if (time > prevTime + 1000) {
let fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) );
prevTime = time;
@proclaim
proclaim / waitForText.js
Created May 15, 2017 07:25
WaitForText custom command for nightwatchjs
var util = require('util');
var events = require('events');
function WaitForText() {
events.EventEmitter.call(this);
}
util.inherits(WaitForText, events.EventEmitter);
WaitForText.prototype.command = function(selector, expectedText, timeoutInSec, callback) {
@rverton
rverton / chrome_headless_screenshot.py
Created July 10, 2017 08:53
Make a screenshot with a headless google chrome in python
# Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads
import os
from optparse import OptionParser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'