Skip to content

Instantly share code, notes, and snippets.

@lsbardel
lsbardel / redis-server-for-init.d-startup
Created December 15, 2009 21:01 — forked from mtodd/redis-server-for-init.d-startup
Init.d Redis script for Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@fiee
fiee / laenderinfos.sql
Last active July 17, 2023 14:04
table of information about all countries of the world (German names)
CREATE TABLE adressen.land
(
isocode_2 character(2) not null, -- ISO 3166 ALPHA-2
isocode_3 character(3) not null, -- ISO 3166 ALPHA-3
name character varying not null, -- deutscher Name des Landes (international besser via ISO-Code ankoppeln!) // German name of the country
vorwahl integer default null, -- internationale Vorwahl // international phone code
null_bei_vorwahl boolean default FALSE, -- muss man die Null der Ortsvorwahl auch nach der internationalen Vorwahl wählen? // must one dial zero between international and local phone code?
vorwahl_lokal boolean default FALSE, -- muss man vor Ort die Vorwahl wählen? // must one dial the local phone code also locally?
tld character varying default NULL, -- Top Level Domain
kfz character varying default NULL, -- KFZ-Kennzeichen // car code
@hubgit
hubgit / solrconfig.xml
Created March 17, 2010 14:38
solrconfig.xml for MoreLikeThis and CSV import
<?xml version="1.0" encoding="UTF-8"?>
<config>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
<mergeFactor>10</mergeFactor>
<ramBufferSizeMB>256</ramBufferSizeMB>
<maxFieldLength>100000000</maxFieldLength>
<writeLockTimeout>1000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
<lockType>native</lockType>
@hubgit
hubgit / schema.xml
Created March 17, 2010 14:39
schema.xml for storing Wikipedia data in Solr
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="wikipedia" version="1.2">
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="0" splitOnNumerics="0" stemEnglishPossessive="1"/>
@emre
emre / sort
Created April 27, 2010 15:08
usort()'un guzel bir ozelligi
<?php
$a[] = array(
"name" => "emre",
"price" => 99,
);
$a[] = array(
"name" => "ali",
"price" => 15,
@emre
emre / django svn installer script
Created June 26, 2010 11:17
Django icin SVN installer scripti
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from distutils.sysconfig import get_python_lib
class Installer(object):
def __init__(self):
self.__controlUser()
@emre
emre / solr_document_remover.py
Created July 29, 2010 09:52
solr'dan tum kayitlari siler.
import solr
# create a connection to a solr server
s = solr.SolrConnection('http://foo/bar/:8180/solr')
# get all documents
response = s.query('*:*')
for hit in response.results:
s.delete(hit['id'])
s.commit()
@emre
emre / proxy.php
Created August 16, 2010 12:32 — forked from hmert/proxy.php
just experimantal
<?php
class ProxyRouterException extends Exception {}
class ProxyRouter {
public $url;
public function __construct($url) {
$this->url = $this->_control_url($url);
@emre
emre / media_url_fix.py
Created August 17, 2010 12:57
HTTPS ustunden bir istek yapildigin media url prefix'ini de https yapar.
# [your-project/context_processors.py]
from django.conf import settings
def ssl_fix(request):
media_url = getattr(settings, 'MEDIA_URL')
if request.is_secure() == True:
media_url = media_url.replace("http://", "https://")
return {
"MEDIA_URL": media_url,
@emre
emre / turkish_tools.py
Created August 28, 2010 12:41
Python icin turkce karakterlere uygun kucultme buyutlme fonksiyonlari
# -*- coding: utf-8 -*-
import re
class TurkishTools(object):
CHAR_MAP = {
"to_upper": {
u"ı": u"I",
u"ö": u"Ö",