Skip to content

Instantly share code, notes, and snippets.

View komly's full-sized avatar

Dmitry Petrov komly

View GitHub Profile
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
class Profile(models.Model):
website = models.URLField(_('website'), null=True, blank=True)
user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='profile')
@font-face {
font-family: "Proxima Nova";
src: url(data:font/opentype;base64,d09GRgABAAAAAEywABIAAAAAg3QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEWU5BAAAGbAAAALgAAAGJNI0oHkZGVE0AAAGUAAAAHAAAABxdnq2WR0RFRgAAByQAAAA4AAAAQgSqBTxHUE9TAAAHXAAABCIAABH0zI0AF09TLzIAAAXUAAAAVwAAAGCAz3p9Y21hcAAASvgAAAG2AAAC5lCJVL9jdnQgAAABsAAAAB4AAAAeCkcLCmZwZ20AAAHQAAABsgAAAmUjtC+nZ2FzcAAAA4QAAAAIAAAACAAAABBnbHlmAAALgAAAO4sAAF8I3FzIU2hlYWQAAAOMAAAANQAAADb9TDtqaGhlYQAABiwAAAAgAAAAJA9PBsBobXR4AABHDAAAAh8AAANsqw8hfGxvY2EAAEksAAABuAAAAbhtqYQ8bWF4cAAABkwAAAAgAAAAIAIDAhpuYW1lAAADxAAAAawAAANRLIw+gnBvc3QAAErkAAAAEwAAACD/DQAocHJlcAAABXAAAABjAAAAdNUcAaMAAAABAAAAAMmJbzEAAAAAyRrF1wAAAADK+niN/pAAAAPGBTYBYADCANABNgE+AWgBmQDkAZIBkAFYAAB42l1Ru05bQRDdDQ+TBBJjg+RoU8xmQhrvhYYCJBBXF8XIdmM5QtqNXORiXMAHUCBRg/ZrBmgoKdKmQcgFUj6BT0BiZk2iKM3Ozuycc+bMknKk6l1a73nqnARSuNOg2abfDql2FuCedH21kZF28EDzzYxeuW7ff8VgM5pyRw2gvOct5SGjaSdQi/bU/za/guE+/2Qeg0FLM01PrZOQHkJgvhm3MPie0ay7/KQvWB0uBgNDimkq7vJzKuV/S3Outgibaxm9dnAmIj+ZBmhqpY1A0186pHo+jmIJctkw1gYTU9afZCL4ZjJd1VQtM751cJfszDt
<?php
function authMiddleware($get) {
if (!isset($get['key']) || $get['key'] != 'secret') {
return 'Unauthorized';
}
return handleRequest($get);
}
function handleRequest($get) {
@komly
komly / nginx.conf
Created March 24, 2016 09:23 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
package main
import (
"fmt"
"sync"
)
type (
Counter struct {
count int
FIRST_TEN = ["one", "two", "three", "four", "five", "six", "seven",
"eight", "nine"]
SECOND_TEN = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen"]
OTHER_TENS = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy",
"eighty", "ninety"]
HUNDRED = "hundred"
ZERO = "ZERO"
server {
listen 80;
#server_name localhost;
root /srv/vhost;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$uri?$args;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int count[3];
int tables = 0;
cin >> count[0] >> count[1] >> count[2];
#!/usr/bin/env python3
import sys
import re
if len(sys.argv) < 3:
print("Usage: %s file_to_read file_to_write" % sys.argv[0])
exit(1)
#!/usr/bin/env python3
import re
import json
from urllib.request import urlopen
start, finish = int(input('Start thread number: ')), int(input('Finish thread number: '))
url = 'http://www.forumishqiptar.com/threads/%d'
def find_posts(text):