Skip to content

Instantly share code, notes, and snippets.

View ertugerata's full-sized avatar
💭
tired

Ertuğrul Erata ertugerata

💭
tired
View GitHub Profile
@colinmollenhour
colinmollenhour / buildhtaccess.sh
Created June 30, 2010 22:42
.htaccess combiner
#!/bin/bash
# Author: Colin Mollenhour
#
# Usage: Run from the webroot, .htaccess-combined will be created.
dest='.htaccess-combined'
pwd=`pwd`
echo -n "" > $dest
while read -r file; do
loc=`dirname $file`
I found a way to install the ubuntu-netbook-remix-i386.img file into VirtualBox. Here are the steps.
1. Run the command to create a bootable VDI image (without quotes):
“VBoxManage convertfromraw ubuntu-netbook-remix-i386.img ubuntu-netbook-remix-i386-live.vdi”
2. Run the command to create a new empty VDI image where to install the image with 8GB space:
“VBoxManage createhd -filename ubuntu-netbook-remix-i386.vdi -size 8000″
Note: you can use -register option at the end of this command or register this VDI file from the VirtualBox later.
3. Create a new VM using the ubuntu-netbook-remix-i386-live.vdi (use the existing vdi option)
4. Attach the ubuntu-netbook-remix-i386.vdi as a Primary Slave
5. Start the VM (boot)
6. Install
@dAnjou
dAnjou / flask-upload
Created June 5, 2012 12:35
Flask upload example
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@cihann
cihann / virtualenv-pip.markdown
Created September 19, 2012 09:03
Virtualenv ve pip üzerine

İşimde ve kendi projelerimde genelde Django kullanıyorum. Django ile yazılım geliştirirken bir çok üçüncü parti uygulama kurmak gerekebiliyor. Örneğin migration işlemleri için south kurmak gerekiyor. Diyelim ubuntu kullanıyorsunuz ve south ubuntu deposunda var. Veya pip, easy_install gibi python paket sistemleri ile kurulum yapıyorsunuz. Bu durumda bu paketler sistemin geneline kuruluyor. Bu durumun ne gibi sıkıntıları var derseniz, projeye özel değişik versiyonda kütüphaneleri denemek zorlaşıyor. İşte tam bu sırada virtualenv gibi harika bir araç yardımımıza koşuyor. virtualenv kısaca bize özel bir python alanı yaratıyor ve orada yaptığımız kurulumların sadece orada geçerli olmasını sağlıyor. Şimdi ubuntu’da adım adım virtualenv kurulumu ve kullanımını inceleyelim.

Öncesinde sistemimizde easy_install ve pip kurulu değilse bu işlemleri halledelim. Terminalde aşağıdaki komutu vererek paket kurulumla

@greatghoul
greatghoul / group_sum.py
Created November 15, 2012 14:24
SqlAlchemy Group By
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from sqlalchemy import create_engine, Column, Integer, String, func
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class StudentInfo(Base):
@caspian311
caspian311 / client.py
Created January 30, 2013 19:36
Simple client-service dbus example in python.
#!/usr/bin/env python
import dbus
class Client():
def __init__(self):
bus = dbus.SessionBus()
service = bus.get_object('com.example.service', "/com/example/service")
self._message = service.get_dbus_method('get_message', 'com.example.service.Message')
self._quit = service.get_dbus_method('quit', 'com.example.service.Quit')
@inkrement
inkrement / i3config
Created April 26, 2013 10:16
i3wm config
exec gnome-settings-daemon
exec --no-startup-id nitrogen --restore
exec --no-startup-id nm-applet
# keyring daemon
exec /usr/bin/gnome-keyring-daemon --start --components=gpg
exec /usr/bin/gnome-keyring-daemon --start --components=secrets
exec /usr/bin/gnome-keyring-daemon --start --components=ssh
exec /usr/bin/gnome-keyring-daemon --start --components=pkcs11
@jcyamo
jcyamo / i3-exit
Last active October 9, 2020 10:26
Exit script for the i3 window manager based off of exit script from CrunchBang Linux.
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
@kwilcox
kwilcox / flask_admin.py
Last active June 20, 2019 13:42
WTForms and GeoAlchemy2
from flask.ext.admin.contrib.sqla import ModelView
# 'location' is the GeoAlchemy2 column
class FeatureView(ModelView):
...
form_overrides = dict(location=WTFormsMapField)
form_args = dict(
location=dict(
geometry_type='Polygon', height=500, width=500, cloudmade_api="{your_api}"
)
@cihann
cihann / golangsetup.txt
Created December 11, 2014 21:14
ubuntu 14.04 golang setup
$ curl -O https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz
Unpack it to the /usr/local
$ tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz
$ mkdir ~/golang
$ echo "export GOPATH=$HOME/go" >> ~/.zshrc