This file contains 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
#pragma once | |
template < typename T > class SP | |
{ | |
private: | |
T* pData; // pointer | |
int* refcnt; // Reference count | |
public: | |
SmartPointer() : pData(0), refcnt(0) | |
{ |
This file contains 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
me@hardy:~$ sudo hcitool scan | |
Scanning ... | |
00:02:C7:7D:F5:17 BlueGPS 7DF517 | |
me@hardy:~$ sudo rfcomm bind /dev/rfcomm0 00:02:C7:7D:F5:17 1 | |
me@hardy:~$ ls -l /dev/rfcomm0 | |
crw-rw---- 1 root dialout 216, 0 2008-12-14 23:15 /dev/rfcomm0 |
This file contains 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
generate drop all tables statement | |
select 'drop table if exists "' || tablename || '" cascade;' from pg_tables where schemaname = 'public'; |
This file contains 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
class backtrace | |
{ | |
boost::shared_array<void*> m_backtrace; | |
size_t m_trace_size; | |
public: | |
static const int DEFAULT_STACK_DEPTH = 100; | |
static const int DEFAULT_EXCLUDE_FIRST_FRAMES_COUNT = 1; | |
typedef std::vector<std::string> stack_type; |
This file contains 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
tar -cvpj /path/to/directory | openssl aes-256-cbc -kfile /path/to/enc.key | split -d -b 4000m - backup.tar.bz2.enc. | |
cat backup.tar.bz2.enc.* | openssl aes-256-cbc -d -kfile /path/to/enc.key | tar xvjf - |
This file contains 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.db.models import Q | |
from django.views.generic import ListView | |
import itertools | |
class BaseSearchView(ListView): | |
search_fields = [] | |
def get_search_fields(self): | |
return self.search_fields | |
query_key = 'q' |
This file contains 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
git remote set-url origin ssh://newhost.com/usr/local/gitroot/myproject.git # change remote url |
This file contains 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
gitolite admin repo – this is where you add new repos, users, and access. | |
git clone ssh://gitolite@hostname_or_ip:ssh_port/gitolite-admin | |
You now have a gitolite-admin directory with conf/ and keydir/ inside. Conf directory contains gitolite.conf file and you will add users, privileges and projects/repos here. Keydir is where you save the ssh key files. Note: Make sure the filename of ssh key matches the user on gitolite.conf without the .pub. As example, you will have your ssh key file in keydir/user.pub and in gitolite.conf you have the following: | |
repo gitolite-admin | |
RW+ = user | |
To add users, upload the ssh key file inside keydir/ and add his access inside gitolite.conf. | |
vi keydir/user2.pub | |
To create new repository, just add the following lines in conf/gitolite.conf: | |
repo drupal_dev | |
RW+ = user user2 |
This file contains 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
tar -c "$srcdir" | tar -C "$destdir" -xv | |
tar -cf archive.tar foo bar | |
tar -xf archive.tar # Extract all files from archive.tar. | |
tar -tvf archive.tar # List all files in archive.tar verbosely. | |
This file contains 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
sudo su - <username> | |
sudo -u username <cmd> |