Skip to content

Instantly share code, notes, and snippets.

View lukmdo's full-sized avatar
:octocat:
loading...

Lukasz Dobrzanski lukmdo

:octocat:
loading...
View GitHub Profile
@lukmdo
lukmdo / MySQL DBA,DBD
Created July 28, 2010 16:12
MySQL profiling
SELECT @@profiling;
SET profiling=1|0;
SHOW PROFILES;
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
SELECT @@global.time_zone, @@session.time_zone;
SET time_zone = '+00:00';
for ((i=1; i<=14; i++)); do
D=`date -v${i}d +%Y%m%d`;
echo $D;
done
@lukmdo
lukmdo / MySQL stored procedures.sql
Created January 4, 2011 17:55
various MySQL stored procedures
drop procedure IF EXISTS clear_db;
DELIMITER //
CREATE PROCEDURE clear_db ()
BEGIN
SET @tName := (SELECT table_name from information_schema.tables where table_schema = DATABASE() ORDER BY table_name LIMIT 1);
WHILE @tName IS NOT NULL DO
# SELECT CONCAT("Dropping tabe: ", @tName) as msg;
SET @s = CONCAT("DROP TABLE ", @tName);
PREPARE dropIT FROM @s;
@lukmdo
lukmdo / gist:951514
Created May 2, 2011 12:12
NFS server setup
1) # vim /etc/exports:
# What_to_share With_whom
ABS_PATH IP(rw,all_squash,anonuid=XXX,anongid=YYY,insecure)
# `all_squash` - turns on mapping. Each file created/modified on the client will be mapped to user
# configured by `ananuid` and `anangid` on the server side.
# `anonuid` - id of server side user of the changed files
# `anangid` - gid of server side group of the changed files
# `insecure` - lests in all requests form port higher then 1024
@lukmdo
lukmdo / eclipse
Created May 15, 2011 13:18
Eclipse stuff
CSS Editor
Eclipse Web Developer Tools
Google App Engine Java SDK
Google Plugin for Eclipse
Google Web Toolkit SDK
PyDev for Eclipse
WTP
Apache MyFaces Trinidad Tag Support (Optional)
Code Coverage - CodePro
@lukmdo
lukmdo / CGI test
Created July 1, 2011 16:36
CGI local testing
export REQUEST_METHOD="GET";
export PATH_INFO="ws/keywords";
export QUERY_STRING="cid=523&tgid=54&begin=20100701&end=20100712";
perl ./cgi/seo2.cgi
@lukmdo
lukmdo / Git tricks
Created July 1, 2011 16:38
Git tricks
git add -p
git stash -p
git reflog
gitk --all `git reflog |cut -c1-7`
git status -M --find-copies-hard
git grep "supae"
git log -S "supae" -p
git log -P
@lukmdo
lukmdo / chunk_iterable.py
Created October 24, 2011 14:45 — forked from ksamuel/chunk_iterable.py
Function to iterate over an iterable chunk by chunk, choosing the number of item of each chunks and the type of the chunk
from itertools import chain, islice
def chunk(seq, chunksize):
""" Yields items from an iterator in iterable chunks."""
it = iter(seq)
while True:
yield chain([it.next()], islice(it, chunksize - 1))
if __name__ == '__main__':
lst = ['a', 'b', 'c', 'd', 'e']
@lukmdo
lukmdo / gist:1373525
Created November 17, 2011 16:01
apple  wird commands

Add existing user to existing group

sudo dseditgroup -o edit -a USERNAME -t user GROUPNAME

Google Notifier AutocheckInterval

defaults write com.google.GmailNotifier AutocheckInterval EVERY_N_MINUTES
defaults delete com.google.GmailNotifier AutocheckInterval # to reset

Enabling/disabling at family commands

@lukmdo
lukmdo / refine_github_geeks.json
Created January 5, 2012 21:43
Google Refine script Github 4people
// More than https://github.com/about
// Uses https://api.github.com/orgs/github/members as data source and fetches user data from the url field
[
{
"op": "core/column-addition-by-fetching-urls",
"description": "Create column userData at index 1 by fetching URLs based on column url using expression grel:value",
"engineConfig": {
"facets": [],
"mode": "row-based"
},