Skip to content

Instantly share code, notes, and snippets.

@perpetual-hydrofoil
perpetual-hydrofoil / unfollow.py
Last active January 19, 2023 01:35
Twitter Unfollow Example (python)
#! /usr/bin/env python
# how to unfollow everyone who isn't following you
# By Jamieson Becker (Public Domain/no copyright, do what you will)
# Easy instructions, even if you don't know Python
#
# 1. Install pip (apt-get install python-pip) and then
# pip install tweepy, which is the python twitter client
#
#! /bin/sh -e
# <jamieson@jamiesonbecker.com>
# as this is designed to be run via wget, user input is not available
echo "Creating jamieson.."
# check for Linux platforms
if [ "x$(uname -a|grep -i linux)" == "x" ]; then
@perpetual-hydrofoil
perpetual-hydrofoil / install-cloud-init-rhel.sh
Last active June 16, 2016 10:02
Install Cloud Init on RHEL
#! /bin/bash
set -e
# Build and install cloud-init on RHEL 6 AMIs
# (Please note: RHEL5 not supported because python 2.4 is too old for even boto)
# This will have undefined behavior on non-RHEL6 systems but should work on CentOS 6.
# Ubuntu and Amazon already have cloud-init.
# temporary build directory
@perpetual-hydrofoil
perpetual-hydrofoil / parallel.js
Last active October 9, 2018 15:22 — forked from paul/parallel.js
fixed typo in $.each statement. (otherwise each url will be a numeral: 0,1,2..)
var results = {};
var requests = 0;
var urls = ["values/1", "values/2", "values/3"];
$.each(urls, function(idx, url) {
$.getJSON(url, function(data) {
results[url] = data.value;
++requests;
@perpetual-hydrofoil
perpetual-hydrofoil / reloader.html
Last active December 15, 2015 00:49
Reloader.html simply reloads / every 500 milliseconds (.5 sec) .. like ReloadEvery but without a plugin.
<html>
<body style="padding:0; margin:0;">
<!-- reloader.html -->
<iframe id=reloader src="/" style="margin:0;border:none;padding:0;height:100%;width:100%"></iframe>
<script>
(function test() {
document.getElementById('reloader').src = document.getElementById('reloader').src;
setTimeout(test, 500); // 500ms = 1/2 second
})();
</script>
On the last machine in the chain:
nc -l 1234 | pigz -d | tar xvf -
On each intermediate machine, you use a fifo to copy the data to the next machine as well as decompressing.
mkfifo myfifo
nc $NEXT_SERVER 1234 <myfifo &
nc -l 1234 | tee myfifo | pigz -d | tar xvf -
/*
* Copyright (C) 2006, 2008 Valery Kholodkov
* Client body reception code Copyright (c) 2002-2007 Igor Sysoev
* Temporary file name generation code Copyright (c) 2002-2007 Igor Sysoev
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>
#!/bin/env python
from smtpd import SMTPChannel, SMTPServer
import asyncore
class LMTPChannel(SMTPChannel):
# LMTP "LHLO" command is routed to the SMTP/ESMTP command
def smtp_LHLO(self, arg):
self.smtp_HELO(arg)

Hyx.less

Hyx is a very powerful and easy to use grid system for less. Think of it like the missing half brother of Jeet.

Features

  • Flexible gutter size: you can change it whenever you want and your grid won't break.
  • Keeps your DOM clean; hyx.less will not fill your HTML with a bunch of classes.
  • Powerful and semantic syntax, .cols(1/3); means one column of three.
  • Use only what you need when you need it. This is a tool to build a grid ad-hoc to your needs. You are not stuck with a rigid API or only one way to build your grid.
// Don't forget to run the shell
// google-chrome --remote-debugging-port=9222
var url = 'http://localhost:9000/';
function startswith(str, prefix) {
return str.substring(0, prefix.length) === prefix;
}
var Chrome = require('chrome-remote-interface');