This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL dump 10.13 Distrib 5.1.42, for unknown-openbsd4.7 (i386) | |
-- | |
-- Host: localhost Database: tmp | |
-- ------------------------------------------------------ | |
-- Server version 5.1.42-log | |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
/*!40101 SET NAMES utf8 */; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream ssl.mydomain.org { | |
server 192.168.77.10:80; | |
server 192.168.77.20:80; | |
server 192.168.77.30:80; | |
} | |
server { | |
server_name ssl.mydomain.org; | |
access_log logs/sslacc.log main; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# atrod atteelus, kas ir mazaaki par 100x100 px un izdod nosaukumus. | |
import os | |
import Image | |
required_height = 100 | |
required_width = 100 | |
def find_small(directory): | |
for dirname, dirpath, filenames in os.walk(directory): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_required | |
def search(request): | |
term = request.GET.get('term', None) | |
context = RequestContext(request) | |
context['search_term'] = term | |
if term is None: | |
context['results'] = SearchQuerySet().none() | |
context['search_term'] = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <evhttp.h> | |
void process_request(struct evhttp_request *req, void *arg){ | |
struct evbuffer *buf = evbuffer_new(); | |
if (buf == NULL) return; | |
evbuffer_add_printf(buf, "Requested: %s\n", evhttp_request_uri(req)); | |
evhttp_send_reply(req, HTTP_OK, "OK", buf); | |
} | |
int main () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpRequest | |
# Safari default security policy restricts cookie setting in first request in iframe | |
# Solution is to create hidden form to preserve GET variables and REPOST it to current URL | |
class IFrameFixMiddleware(object): | |
""" middleware fixes sessions with Safari browser in iframes """ | |
def process_request(request): | |
if request.META['HTTP_USER_AGENT'].find('Safari') != -1 and 'sessionid' not in request.COOKIES and 'cookie_fix' not in request.GET: | |
html = """<html><body><form name='cookie_fix' method='GET' action='.'>""" | |
for item in request.GET: | |
html += "<input type='hidden' value='%s' name='%s' />" % (request.GET[name], name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find sum of all non-prime numbers in range(100) | |
def eulers_sieve(n): | |
c = range(n+1) | |
fin = int(n**0.5) | |
for i in xrange(2, fin+1): | |
if not c[i]: | |
continue | |
c[2*i::i] = [None] * (n//i - 1) | |
return [i for i in c[2:] if i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"http" | |
"fmt" | |
) | |
func main() { | |
r, _, err := http.Get("http://www.websvarki.lv/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = ""; | |
$user = ""; | |
$pass = ""; | |
$file = "" | |
$link = mysql_connect($host, $user, $pass); | |
mysql_query("set names utf8;"); | |
mysql_query("USE truevision"); | |
$file = file_get_contents($file); |
OlderNewer