Skip to content

Instantly share code, notes, and snippets.

View ivpusic's full-sized avatar
👨‍💻

Ivan Pusic ivpusic

👨‍💻
View GitHub Profile
@tito
tito / poll_delegate_objus.py
Created February 1, 2014 15:19
Which delegate usage would be the best to have in Pyobjus ?
# Solution 1
# original solution proposed in the PR
# pro: easy declaration
# cons: instanciation is a little bit hard to write
# possible method conflict with multiple protocols
class MyObjcDelegate:
def connection_didFailWithError_(self, connection, error):
print("Protocol method got called!!", connection, error)
@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@sylr
sylr / postgres-9.5-sharding.sh
Last active June 11, 2019 21:23
Postgresql 9.5 sharding example
echo master shard_{0,1,2,3} | xargs -n1 /usr/local/bin/dropdb -p 6432 -h /tmp -U postgres
echo master shard_{0,1,2,3} | xargs -n1 /usr/local/bin/createdb -p 6432 -h /tmp -U postgres
for a in {0..3}; do
echo "
CREATE TABLE users (id serial PRIMARY KEY, username TEXT NOT NULL);
ALTER SEQUENCE users_id_seq INCREMENT BY 4 RESTART WITH $a;
" | /usr/local/bin/psql -p 6432 -h /tmp -U postgres -d shard_$a;
done