Skip to content

Instantly share code, notes, and snippets.

@nuklea
nuklea / 20custom-hcd.sh
Created Jun 15, 2012
Script for corrent unbind usb devices before suspend
View 20custom-hcd.sh
#!/bin/sh
# Put this file into /etc/pm/sleep.d and don't forget
# `chmod +x to /etc/pm/sleep.d/20custom-hcd.sh'
# See http://ubuntuforums.org/showpost.php?p=11534892&postcount=88
TMPLIST=/tmp/hdc-dev-list
case "${1}" in
hibernate|suspend)
@nuklea
nuklea / dynamic-query.sql
Last active Aug 29, 2015
Dynamic table name in query
View dynamic-query.sql
DO $$
DECLARE
r record;
BEGIN
FOR r IN SELECT tablename FROM pg_catalog.pg_tables WHERE tablename LIKE 'schema_%%' LOOP
EXECUTE 'UPDATE ' || quote_ident(r.tablename) || ' SET host_added = ''54auto.ru'' WHERE host_added = ''54.ruauto.ru''';
END LOOP;
END $$ LANGUAGE plpgsql;
View di.user.js
// ==UserScript==
// @name Digitally Imported
// @version 0.1.2
// @description Не дает проигрывателю заткнуться
// @author Vladislav Polukhin <nuklea@gmail.com>
// @match *://www.di.fm/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
View redmine.user.js
// ==UserScript==
// @name Redminy story counter
// @version 0.2.2
// @description try to take over the world!
// @author Vladislav Polukhin <nuklea@gmail.com>
// @match http://redmine.24auto.ru/*
// @grant none
// ==/UserScript==
function mceil(number, roundto){
View gist:9bf765ae0b8ef95e84fed56900fa5b89
class GeocoderPipeline(object):
namespaces = {'gml': 'http://www.opengis.net/gml',
'ymaps': 'http://maps.yandex.ru/ymaps/1.x',
'geocoder': 'http://maps.yandex.ru/geocoder/1.x'}
@classmethod
def from_crawler(cls, crawler):
try:
pipe = cls.from_settings(crawler.settings)
except AttributeError: