Skip to content

Instantly share code, notes, and snippets.

View maxmoriss's full-sized avatar
🤤
wubba lubba dub dub

maxmoriss

🤤
wubba lubba dub dub
View GitHub Profile
@maxmoriss
maxmoriss / rouble.css
Created July 23, 2018 21:03
Rouble sign
@font-face {
font-family: 'RoubleArial';
src: url("data:font/truetype;base64,AAEAAAAQAQAABAAATFRTSAM8AgsAAAIMAAAADU9TLzJniF9NAAABiAAAAGBWRE1Ybm52mQAAAhwAAAXgY21hcAl/E/EAAAkYAAABJGN2dCAAFAAAAAALyAAAAAZmcGdtBlmcNwAACjwAAAFzZ2x5ZhX5T20AAAvQAAABSGhkbXgFN29VAAAH/AAAARxoZWFkA2yHgwAAAQwAAAA2aGhlYQeHA4MAAAFEAAAAJGhtdHgItwCeAAAB6AAAACRsb2NhAUgBSAAADRgAAAAUbWF4cAIWAZkAAAFoAAAAIG5hbWVNQun4AAANLAAAATtwb3N0+R8+aAAADmgAAABRcHJlcBz8fZwAAAuwAAAAFgABAAAAAQAAYsvmyF8PPPUAGQPoAAAAANBQc58AAAAA0FLQQgCeAAAC/wK8AAAACQACAAAAAAAAAAEAAAMg/zgAyAPoAJ4AWQL/AAEAAAAAAAAAAAAAAAAAAAAJAAEAAAAJACUAAgAAAAAAAQAAAAAACgAAAgABcwAAAAAAAwE+AZAABQAAArwCigAAAIwCvAKKAAAB3QAyAPoAAAIAAAAAAAAAAAAAAAIBAAAAAAAAAAAAAAAAUFlSUwBAAAAEQwMg/zgAyAK8AAAAAAABAAAAAAGQAyAAAAAgAAAASwAAA+gAAAAAAAAASwAAAEsAAANYAJ4ASwAAAEsAAAAAAAAAAAAJAQEBAQE7AQEBAAAAAAAAAQABAQEBAQAMAPgI/wAIAAYAAAAJAAcAAAAKAAcAAAALAAgAAAAMAAkAAAANAAoAAAAOAAoAAAAPAAsAAAAQAAwAAAARAAwAAAASAA0AAAATAA4AAAAUAA4AAAAVAA8AAAAWABAAAAAXABEAAAAYABEAAAAZABIAAAAaABMAAAAbABMAAAAcABQAAAAdABUAAAAeABUAAAAfABYAAAAgABc
#! -*- coding: utf-8 -*-
import logging
import hashlib
from urlparse import urlparse, parse_qs
import requests
from django.conf import settings
<!-- Olympic medals widget -->
<div class="olympic-medals-block">
<div class="right_block right_more">
<p class="mkh2 mkblock">
<a href="/olympic-2016/" class="olympic-medals-block__title">Медальный зачет</a>
<!-- adv pic -->
<!-- <a href="#" class="olympic-medals-block__adv"><img src="" alt=""></a> -->
</p>
<table>
<tr>
<!-- Olympic medals widget -->
<div class="olympic-medals-block">
<div class="right_block right_more">
<p class="mkh2 mkblock">
<a href="/olympic-2016/" class="olympic-medals-block__title">Медальный зачет</a>
<!-- adv pic -->
<!-- <a href="#" class="olympic-medals-block__adv"><img src="http://img03.deviantart.net/741e/i/2008/117/a/1/bmw_logo_by_transcendentalpeace.png" alt=""></a> -->
</p>
<table>
<tr>
<table class="olympic-medals">
<tr>
<th>Страна</th>
<th title="Количество золотых медалей"><div>&nbsp;</div></th>
<th title="Количество серебрянных медалей"><div>&nbsp;</div></th>
<th title="Количество бронзовых медалей"><div>&nbsp;</div></th>
<th title="Общее количество медалей"><div>&nbsp;</div></th>
</tr>
<tr>
<td>Россия</td>
@maxmoriss
maxmoriss / formview.py
Created May 22, 2016 23:26
Example of FormView class based views of django
from django.views import generic
class EmailPreferenceView(generic.FormView):
form_class = EmailPreferenceForm
def get(self, *args, **kwargs):
# You can access url variables from kwargs
# url: /email_preferences/geeknam > kwargs['username'] = 'geeknam'
# Assign to self.subscriber to be used later
self.subscriber = get_subscriber(kwargs['username'])
@maxmoriss
maxmoriss / m2m.py
Created May 22, 2016 23:23
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
def __unicode__(self):
@maxmoriss
maxmoriss / install-stuff.sh
Created February 18, 2016 22:48
Setup environment
# update
sudo apt-get update
sudo apt-get upgrade
# system stuff
sudo apt-get install zsh
sudo apt-get install git
sudo apt-get install nginx
# python
@maxmoriss
maxmoriss / move-thumbnails.py
Last active January 5, 2016 22:21
Script attempts to find images with equal dimensions and move it to another directory.
# -*- coding: utf-8 -*-
import os
import sys
from PIL import Image
from shutil import move
from stat import S_IWRITE
from argparse import ArgumentParser
from abc import ABCMeta, abstractmethod
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see: