Skip to content

Instantly share code, notes, and snippets.

View keerati's full-sized avatar

keerati keerati

  • Bangkok, Thailand
View GitHub Profile
@keerati
keerati / gist:a54f141b1d4fc2c4cdb7
Created May 18, 2015 03:22
simple dict excel reader
class DictExcelReader(object):
def __init__(self, workbook, sheet_name_or_index):
self.workbook = workbook
self.worksheet = self.workbook.sheet_by_index(sheet_name_or_index) \
if type(sheet_name_or_index) == int else \
self.workbook.sheet_by_name(sheet_name_or_index)
self._ncols = self.worksheet.ncols
self.rows = self.worksheet.nrows
@keerati
keerati / gist:4335752
Created December 19, 2012 10:19
error memcache fast
!!!/var/builder/perl/0_0-1_all.deb does not exist!!!
Deleting 205296 from tagque. Builder: Perlbuilder
Building Catalyst::Plugin::Session::Store::Memcached::Fast from CPAN
Running perl /usr/local/bin/cpanbuild 0 0 Catalyst::Plugin::Session::Store::Memcached::Fast 2>&1
Build: 2012/12/19 10:35:02 [INFO] build.START CpanBuild.pm:run 30> cpanbuild 0
2012/12/19 10:35:02 [TRACE] Build.Debian.Base Base.pm:_build__repoplugins 1256> mod : Build::Debian
2012/12/19 10:35:02 [TRACE] Build.Debian.Base Base.pm:_build__repoplugins 1258> found: Build::Debian::RepoPlugins::Drupal,Build::Debian::RepoPlugins::URI,Build::Debian::RepoPlugins::GIT,Build::Debian::RepoPlugins::CPAN,Build::Debian::RepoPlugins::SVN
2012/12/19 10:35:02 [INFO] Build.Debian.Base Base.pm:extract_to_build 1245> Use this repoplugin: Build::Debian::RepoPlugins::CPAN!
2012/12/19 10:35:02 [DEBUG] Build.Debian.RepoPlugins.CPAN CPAN.pm:extract 78> We have Catalyst::Plugin::Session::Store::Memcached::Fast and its a symbolic link.
2012/12/19 10:35:02 [TRACE]
@keerati
keerati / caveats
Created December 18, 2012 16:00
mysql caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
and view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
@keerati
keerati / gist:3897342
Created October 16, 2012 05:19
cpanp log
Keeratis-iMac:startsiden-frontpage-admin keerati$ cpanp
CPANPLUS::Shell::Default -- CPAN exploration and module installation (v0.9103)
*** Please report bugs to <bug-cpanplus@rt.cpan.org>.
*** Using CPANPLUS::Backend v0.9103.
*** ReadLine support available (try 'i Term::ReadLine::Perl').
*** Type 'p' now to show start up log
Did you know...
The documentation in CPANPLUS::Module and CPANPLUS::Backend is very useful
@keerati
keerati / gist:3738637
Created September 17, 2012 17:30
overriding the useradmin
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext, ugettext_lazy as _
# the purpose here is to override UserAdmin so that
# it can filter out permission section in Change User Page dynamically
class CustomUserAdmin(UserAdmin):
@keerati
keerati / gist:3736420
Created September 17, 2012 09:26
diff
Keeratis-iMac:startsiden-frontpage-schema keerati$ script/startsiden_frontpage_schema_dbic_migrate.pl status
Schema is 4
Deployed database is 3
Keeratis-iMac:startsiden-frontpage-schema keerati$ dbic-migration status
Can't infer schema class without a --schema or --schema_class at /Users/keerati/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/DBIx/Class/Migration.pm line 71.
Keeratis-iMac:startsiden-frontpage-schema keerati$ dbic-migration status --schema_class Startsiden::Frontpage::Schema
Schema is 4
Database is not currently installed
Keeratis-iMac:startsiden-frontpage-schema keerati$
@keerati
keerati / gist:3705024
Created September 12, 2012 07:48
folder
Keeratis-iMac:Web keerati$ ls
Controller Model View widget-config
Keeratis-iMac:Web keerati$ pwd
/Users/keerati/my_workspace/startsiden-frontpage-web/lib/Startsiden/Frontpage/Web
Keeratis-iMac:Web keerati$
@keerati
keerati / gist:3496509
Created August 28, 2012 09:25
buildertag error
Attribute (tagversion) does not pass the type constraint because: Validation failed for 'HashRef' with value undef at accessor App::BuilderTag::tagversion (defined at /Users/keerati/my_workspace/startsiden-build-tools/bin/../lib/App/BuilderTag.pm line 115) line 18
App::BuilderTag::tagversion('App::BuilderTag=HASH(0x7fcdc1d97a20)') called at /Users/keerati/my_workspace/startsiden-build-tools/bin/../lib/App/BuilderTag.pm line 133
App::BuilderTag::_build_version('App::BuilderTag=HASH(0x7fcdc1d97a20)') called at accessor App::BuilderTag::version (defined at /Users/keerati/my_workspace/startsiden-build-tools/bin/../lib/App/BuilderTag.pm line 128) line 14
App::BuilderTag::version('App::BuilderTag=HASH(0x7fcdc1d97a20)') called at /Users/keerati/my_workspace/startsiden-build-tools/bin/../lib/App/BuilderTag.pm line 109
App::BuilderTag::_build_filename('App::BuilderTag=HASH(0x7fcdc1d97a20)') called at accessor App::BuilderTag::filename (defined at /Users/keerati/my_workspace/startsiden-build-tools/bin/../lib/App/Bu
@keerati
keerati / LICENSE.txt
Created March 4, 2012 08:19 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE