Skip to content

Instantly share code, notes, and snippets.

@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
*
По адресу trackDomain должен находиться скрипт response.php или аналог.
Куки можно читать оттуда же.
@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) {
@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
{
"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",
<?php
/**
* Stream XML parser, with closure and callbacks
* Warning - tags in path are case sensitive!
* @author thefish <trashmailbox@e1.ru>
*/
class Parser {
/**
* @var array An array of registered callbacks
@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
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad.IO.Class (liftIO)
import Network.HTTP.Types
import Network.Wai.Middleware.RequestLogger
import Network.Wai.Middleware.Static
@thefish
thefish / klavaorg-telegram-links.md
Last active January 10, 2018 14:42
Klava.org - Полезные ссылки для Телеграм-чата
# -*- coding: utf-8 -*-
# Simple example which uses a pool of workers to carry out some tasks.
#
# Notice that the results will probably not come out of the output
# queue in the same in the same order as the corresponding tasks were
# put on the input queue. If it is important to get the results back
# in the original order then consider using `Pool.map()` or
# `Pool.imap()` (which will save on the amount of code needed anyway).