Skip to content

Instantly share code, notes, and snippets.

View KrzysztofCiba's full-sized avatar

Krzysztof Daniel Ciba KrzysztofCiba

View GitHub Profile
@KrzysztofCiba
KrzysztofCiba / revert.C
Created February 6, 2013 22:08
revert words ina sentence C
#include <stdio.h>
void revertWord( char *start, char *end ) {
char temp;
while( start < end ) {
temp = *start;
*start = *end;
*end = temp;
++start;
--end;
@KrzysztofCiba
KrzysztofCiba / revert.cpp
Created February 6, 2013 22:01
Revert words in a sentence (using stack).
#include <iostream>
#include <sstream>
#include <stack>
using namespace std;
// using stack
string revertStack( string sentence ) {
stringstream inout(sentence);
string word, news;
@KrzysztofCiba
KrzysztofCiba / revertSentence.py
Created February 6, 2013 21:57
revertSentenc
sentence = "The quick brown fox jumped over the lazy dog."
print "before: ", sentence
sentence = " ".join( sentence.split()[::-1] )
print "after: ", sentence
@KrzysztofCiba
KrzysztofCiba / TypedList.py
Last active August 25, 2021 09:30
TypedList: definition of a python list that can hold only items of desired type.
########################################################################
# $HeadURL $
# File: TypedList.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2012/07/19 08:21:16
########################################################################
""" :mod: TypedList
=======================
.. module: TypedList
:synopsis: typed list
@KrzysztofCiba
KrzysztofCiba / Batting.java
Created November 13, 2012 16:39
haddop batting
//Standard Java imports
import java.io.IOException;
import java.util.Iterator;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
public class Batting {
@KrzysztofCiba
KrzysztofCiba / Graph.py
Created October 8, 2012 15:53
simple graph
########################################################################
# $HeadURL $
# File: Graph.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2012/09/27 07:22:15
########################################################################
""" :mod: Graph
=======================
.. module: Graph
#!/bin/sh
REPOS="$1"
TXN="$2"
AEOLUS=/PATH/TO/REPO/hooks/aeolus.py
#line endings
$AEOLUS -t "$TXN" "$REPOS" || exit 1
exit 0
!/usr/bin/env python
# @file aeolus.py
# @author Krzysztof Danile Ciba (Krzysztof.Ciba@NOSPAMgmail.com)
# @brief svn pre-commit hook for checking correct line endings
import os, sys
import re
import svn
import svn.fs
import svn.repos
import svn.core
class IncludeRegexpStrategyRule(StrategyRule):
"""Include symbols matching pattern."""
def __init__(self, pattern):
try:
self.regexp = re.compile('^' + pattern + '$')
except re.error:
raise FatalError("%r is not a valid regexp." % (pattern,))
@KrzysztofCiba
KrzysztofCiba / b.txt
Created October 1, 2012 20:25
trash8
[Fri, 04 Nov 14:17 E0][cibak@localhost:~/test]> python test.py
##### creating child
in child, gX is there? False
in child, foo is there? False
##### baseClass.run() execution
in base class run
gX = 1
function foo called
##### testChild.myRun() execution
in testChildMyRun