Skip to content

Instantly share code, notes, and snippets.

@thefish
thefish / monaco-ubuntu-antialias.sh
Last active August 29, 2015 13:58
Monaco font on Ubuntu with antialiasing
#!/bin/bash
cd /usr/share/fonts/truetype/
sudo mkdir ttf-monaco
cd ttf-monaco/
sudo wget http://www.gringod.com/wp-upload/software/Fonts/Monaco_Linux.ttf
sudo mkfontdir
<?php
/**
* Stream XML parser, with closure and callbacks
* Warning - tags in path are case sensitive!
* @author thefish <[email protected]>
*/
class Parser {
/**
* @var array An array of registered callbacks
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@thefish
thefish / ddos-autoban.sh
Last active December 23, 2015 03:59
Autoban scripts for dumb DDoS (FreeBSD)
#!/bin/sh
while read count ip
do
test $count -gt 100 && echo " ipfw add deny all from $ip to me"
done
@thefish
thefish / utf8-win1251
Created May 21, 2013 08:31
JS utf-8 to windows-1251 string converter
//utf8 to 1251 converter (1 byte format, RU/EN support only + any other symbols) by drgluck
function utf8_decode (aa) {
var bb = '', c = 0;
for (var i = 0; i < aa.length; i++) {
c = aa.charCodeAt(i);
if (c > 127) {
if (c > 1024) {
if (c == 1025) {
c = 1016;
} else if (c == 1105) {
По адресу trackDomain должен находиться скрипт response.php или аналог.
Куки можно читать оттуда же.
@thefish
thefish / bootstrap-typeahead-objects-array.js
Created September 5, 2012 12:47
twitter bootstrap typeahead modified to work with array of key-value objects.
/* =============================================================
* bootstrap-typeahead.js v2.1.1
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*