Skip to content

Instantly share code, notes, and snippets.

@nonamenix
nonamenix / IPNB TOC
Last active December 17, 2015 07:08
<div id="toc-static"></div>
**TOC**
<div id="toc-wrapper">
<div class="header">Contents <a href="#" class="hide-btn">[hide]</a></div>
<div id="toc"></div>
</div>
# https://github.com/ipython/ipython/issues/1527/
import sys, time
try:
import IPython
clear_output = IPython.core.display.clear_output
except:
IPython = None
class ProgressBar:
@nonamenix
nonamenix / build_env.sh
Last active December 27, 2015 12:09
make django project environment
#!/bin/bash
echo $0: Creating virtual environment
virtualenv_name = ${1:-<myenv>}
virtualenv --prompt="$virtualenv_name" ./env
mkdir ./logs
mkdir ./pids
mkdir ./db
mkdir ./static_content
mkdir ./static_content/media
@nonamenix
nonamenix / .xmobarrc
Created November 24, 2013 20:19
Desktop environment
Config {
font = "xft:DejaVu Sans Mono:size=10:bold:antialias=true"
, bgColor = "#balck"
, fgColor = "grey"
, border = NoBorder
, borderColor = "black"
, lowerOnStart = True
-- , position = Static { xpos = 1280, ypos = 0, width = 230, height = 20 }
, position = TopW R 15
, commands = [
@nonamenix
nonamenix / zip
Created February 16, 2014 17:57
CoffeeScript / Zip function for dict comprehension
zip = (pairs) ->
dict = {}
dict[key] = value for [key, value] in pairs
dict
# Example
zip ([el, el * el] for el in [4..8]) # {4:16, 5:25, 6:36, 7:49, 8:64}
from lxml import html
class User(object):
def __init__(self, username):
self.username = username
def achievements(self):
try:
page = html.parse(user_achievements_url %{'username':self.username})
except IOError:
@nonamenix
nonamenix / speedtest.py
Created January 31, 2016 19:45
Twit about your provider speed
#!/usr/bin/python
"""
Original post: http://thenextweb.com/shareables/2016/01/31/frustrated-comcast-customer-sets-up-bot-to-tweet-complaints-every-time-internet-speed-drops/
"""
import os
import sys
import csv
import datetime
import time
import twitter
@nonamenix
nonamenix / main.py
Created October 16, 2016 10:48
GreatFuckingAdvice Telegram Bot
from aiotg import Bot, aiohttp
from utils import html_decode
bot = Bot(api_token="***")
advice_api_url = "http://fucking-great-advice.ru/api/{}"
sound_url = 'http://fucking-great-advice.ru/files/sounds/{}' # sound_9.MP3
@nonamenix
nonamenix / crawler.py
Created January 22, 2017 13:01 — forked from jmoiron/crawler.py
Simple gevent/httplib2 web crawler.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple async crawler/callback queue based on gevent."""
import traceback
import logging
import httplib2
import gevent
@nonamenix
nonamenix / gist:07fbfb2703c4d903e56d490090ac83bc
Created February 28, 2017 12:47
Фундаментальные знания для работы с Нейронными сетями.
Общие сведения о нейронных сетях.
Строение нейронных сетей.
Описание основных функций активации.
Архитектура однослойных НС.
Архитектура многослойных НС.
Правило обучения Хебба.
Правило обучения Розенблатта.
Правило обучения Уидроу-Хоффа.
Многослойный персептрон.
Алгоритм обратного распространения ошибки.