This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#server | |
import socket | |
import threading | |
import time | |
SIZE = 4 | |
soc = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
soc.bind(('127.0.0.1',5432)) | |
soc.listen(5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
OCCUPIED = 1 # oznaka da se polje koristi | |
FREE = 0 # oznaka da je polje prazno | |
OUTPUT = True # zastavica za oznaku dal je ispis omogucen | |
# vracanje kontenjera(ploce) bez vrijednosti | |
def remove(container, value): | |
container.remove(value) | |
return container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/udev/rules.d/51-android.rules | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”0502″, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”0B05″, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”413C”, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”0489″, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”091E”, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”18D1″, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”109B”, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”0BB4″, MODE=”0666″, GROUP=”plugdev” | |
SUBSYSTEM==”usb”, ATTR{idVendor}==”12D1″, MODE=”0666″, GROUP=”plugdev” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rmatrix='echo -ne "\e[31m" ; while true ; do echo -ne "\e[$(($RANDOM % 2 + 1))m" ; tr -c "[:print:]" " " < /dev/urandom | dd count=1 bs=50 2> /dev/null ; done' | |
alias gmatrix='echo -ne "\e[32m" ; while true ; do echo -ne "\e[$(($RANDOM % 2 + 1))m" ; tr -c "[:print:]" " " < /dev/urandom | dd count=1 bs=50 2> /dev/null ; done' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq backup-directory-alist | |
`((".*" . ,temporary-file-directory))) | |
(setq auto-save-file-name-transforms | |
`((".*" ,temporary-file-directory t))) | |
(setq backup-directory-alist '(("." . "~/.emacs.d/backup")) | |
backup-by-copying t ; Dont delink hardlinks | |
version-control t ; Use version numbers on backups | |
delete-old-versions t ; Automatically delete excess | |
kept-new-versions 20 ; how many of the newest version | |
kept-old-versions 5 ; and how many of the old |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mkcd() { mkdir "$1" && cd "$_"; } | |
function extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2012-09-08T09:34:29+00:00 app[web.1]: 2012-09-08 04:34:29 [2] [INFO] Handling signal: term | |
2012-09-08T09:34:29+00:00 app[web.1]: Traceback (most recent call last): | |
2012-09-08T09:34:29+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run | |
2012-09-08T09:34:29+00:00 app[web.1]: result = self._run(*self.args, **self.kwargs) | |
2012-09-08T09:34:29+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/socketio/virtsocket.py", line 389, in _watcher | |
2012-09-08T09:34:29+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/gevent/hub.py", line 79, in sleep | |
2012-09-08T09:34:29+00:00 app[web.1]: gevent.sleep(1.0) | |
2012-09-08T09:34:29+00:00 app[web.1]: SystemExit: 0 | |
2012-09-08T09:34:29+00:00 app[web.1]: switch_result = get_hub().switch() | |
2012-09-08T09:34:29+00:00 app[web.1]: <Greenlet at 0x3372730: <bound method Socket._watcher of <socketio.virtsocket.Socket object at 0x34ec9d0>>> failed with SystemExit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
void removeDuplicates(std::vector<T>& vec) | |
{ | |
std::sort(vec.begin(), vec.end()); | |
vec.erase(std::unique(vec.begin(), vec.end()), vec.end()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
bool BinSearch( string P[], string K, int i, int j ) | |
{ | |
if ( j - i <= 0 ) | |
if ( i == j && P[ i ] == K ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool BinSearch( float P[ ], float K, int i, int j ) | |
{ | |
if ( j - i <= 0 ) | |
if ( i == j && P[ i ] == K ) | |
return true; | |
else | |
return false; | |
else | |
{ | |
int k = ( i + j ) / 2; |