Skip to content

Instantly share code, notes, and snippets.

@marcellmars
marcellmars / jpeg_sequence2pdf.sh
Created Jul 29, 2010
make one pdf from bunch of jpegs (dirty, not prepared as generic script)
View jpeg_sequence2pdf.sh
for i in *; do jpegtopnm $i > $i.pnm;done
for i in *.pnm;do pnmtops $i > $i.ps;done
for i in *.ps;do ps2pdf $i $i.pdf;done
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=contract.pdf -dBATCH contract002.jpg.pnm.ps.pdf contract002-1.jpg.pnm.ps.pdf contract002-2.jpg.pnm.ps.pdf contract002-3.jpg.pnm.ps.pdf contract002-4.jpg.pnm.ps.pdf
@marcellmars
marcellmars / findyourpath.py
Created May 11, 2011
python script finds its own current path
View findyourpath.py
#!/usr/bin/env python
import os
mypath = os.path.dirname(os.path.realpath(__file__))
if __name__ == '__main__':
print mypath
@marcellmars
marcellmars / checkmemory.py
Created Feb 19, 2012
Check total memory and if used more than 3.0GB and make desktop notification with programs which use more than 2.0GB
View checkmemory.py
#!/usr/bin/env python2
import commands, pynotify, sys, os, time
while 1:
lines = commands.getoutput('sudo ps_mem.py').split('\n')
total = [float(str(l).split(" ")[-2]) for l in lines if l.startswith(" ") and l.find("GiB")]
progs = [str(l).split("=")[1].strip().split(" ") for l in lines if l.find("GiB") != -1 and not l.startswith(" ")]
for prog in progs:
View README.md

What

books. soon.

Requirements

  • a server with a public ip (1.2.3.4 in this document)
View Public library
## CONTEXT ##
It’s a simple idea: public library is one of those almost invisible infrastructures that we start to notice only once they go extinct. A place where all people can get access to all knowledge that can be collected. In the past it relied on the limited resources of rich patrons or unstable budgets of (welfare) states. With internet, as in many other instances, the dream about universal access got much more imaginable. It seemed just an issue of interpreting when the trajectory curves of global personal computer distribution and internet access penetration would finally make universal access to knowledge a reality. However, the actual trajectory of development of public libraries in the age of internet are pointing in the opposite direction – that the phenomena we people are most proud of are being undercut and can easily go extinct.
Public libraries now cannot receive, and sometimes not even buy, the books of some of the largest publishers. The books that they already hold they must destroy aft
View Public library
**PUBLIC LIBRARY**
----------
<img src="http://i.imgur.com/XlLRZBN.png"width="320"/>
[TOC]
## <a id="infrastructure"></a>Public Library (as infrastructure) ##
### Context ###
View Otokultivator
I arhitekti sanjaju. Pogotovo kad su mladi. Nikada prije i nikada poslije - Otokultivatora - nitko od nas tko je gradio i živio taj mali gradić nije to uspio ponoviti.
U ljeto 2000. mladi arhitekti Jakov Šrajer, _____ ____, ____ ___ tražili su mjesto na kojem bi se održao dvadeset drugi skup evropskih studenata arhitekture. Našli su ga na otoku Visu: bivšu vojarnu Samogor.
Od 1981. članovi EASA-e (European Architecture Students Assembly) svake godine (samo)organiziraju skup na nekom egzotičnom mjestu gdje dozvoljavaju da se spontanim procesima, često na licu mjesta, dogodi program zanimljiv svim sudionicima.
U ljeto 2001. održan je prvi Otokultivator u suradnji hrvatske EASA-e, URK-a i Multimedijalnog instituta - Mame. Starije lokalno stanovništvo pamti to kao do tada neviđeni izlazak raznolikih čudovišta iz Močvare. Trajekti su time izgubili svoj karakter bezazlenog transporta, a trogodišnje havarije još uvijek se lokalci sjećaju kao Močvare s Močvarcima.
U Samogoru, iza brda, u kotlini, sa vlastitom mik
@marcellmars
marcellmars / mongodb_queries
Created Nov 3, 2013
mongodb queries, updates, etc.
View mongodb_queries
**filemongodb (letssharebooks collection)**
----------
[TOC]
### start mongodb in docker
sudo docker run -d librarian/mongodb --noprealloc --smallfiles
### get list of authors/titles sorted
authors_sorted= sorted(db.books.find().distinct('authors'))
titles_sorted = sorted(db.books.find().distinct('title_sort'))
@marcellmars
marcellmars / PublicLibraryLocalSetup_no-docker.md
Created Nov 19, 2013
Public Library local setup (no docker).md
View PublicLibraryLocalSetup_no-docker.md

view this document here: https://stackedit.io/viewer#!provider=gist&gistId=7547779&filename=PublicLibraryLocalSetup_no-docker.md

[TOC]

Overview

SSH tunneling

Calibre plugin [let's share books] establishes SSH tunnel as a user tunnel with SSH server through port 722 without authorization.

That allows local [Calibre content server][1] to get proxied through SSH tunnel and Nginx so Calibre content server can get its own public URL (i.e. https://www3493.memoryoftheworld.org). Local Calibre library is then accessible from the world to which Nginx is exposed. In production setup that's memoryoftheworld.org, in development setup that's usually only developer's laptop.

View LetsShareBoks_TODO.md