This file contains 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
int memory_usage(){ | |
char buf[30]; | |
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid()); | |
FILE * file = fopen(buf, "r"); | |
setbuf(file, NULL); | |
unsigned res; | |
if(file) | |
fscanf(file, "%u", &res); | |
fclose(file); |
This file contains 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
/** | |
* Zwalnia wszyskie bloki pamieci oraz sama liste. | |
*/ | |
void dispose_list(struct list * l){ | |
struct block * it = l->first, *tmp; | |
while(it != NULL){ | |
tmp = it->next; | |
delete_block(it, l); | |
it = tmp; | |
} |
This file contains 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
exports.processLogin = function (req, res){ | |
var User = mongoose.model('Users'); | |
var id; | |
var u = User.where('login', req.body.login).find({}, function(err, docs){ | |
req.session.userId = docs[0]._id; | |
User.where('login', req.body.login).where('password', models.createHash(req.body.password)).count(function(err, count){ | |
if(err || count == 0) | |
res.render('login', {title: 'log in'}); | |
else{ | |
req.session.loggedIn = true; |
This file contains 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
node-example@0.0.1 /home/michal/Desktop/programming/node.js/simple-bookmarks | |
├─┬ connect-form@0.2.1 | |
│ └── formidable@1.0.9 | |
├─┬ connect-redis@1.3.0 | |
│ └── debug@0.6.0 | |
├── UNMET DEPENDENCY crypto >= 0.0.3 | |
├─┬ express@2.5.8 | |
│ ├─┬ connect@1.8.5 | |
│ │ └── formidable@1.0.9 | |
│ ├── mime@1.2.4 |
This file contains 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
michal@debian~/Desktop/programming/node.js/simple-bookmarks [master]$ git status | |
# On branch master | |
# Untracked files: | |
# (use "git add <file>..." to include in what will be committed) | |
# | |
# decorator.js | |
# dokumentacja/analiza.systemu.aux | |
# dokumentacja/biblio.aux | |
# dokumentacja/index.aux | |
# dokumentacja/index.out |
This file contains 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 validateLogin(input){ | |
if(input.val().length < 1){ | |
addMessage(input.parent(), 'Please provide login'); | |
return false; | |
} | |
if(!input.val().match(/^[a-zA-Z0-9_-]+$/)){ | |
addMessage(input.parent(), 'Provided login contains invalid characters (letters, numbers, hyphen and underscore allowed)'); | |
return false; | |
} | |
$.get("isLoginAvailable/" + $("#login").val(), function(data){ |
This file contains 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 validateLogin(input){ | |
if(input.val().length < 1){ | |
addMessage(input.parent(), 'Please provide login'); | |
return false; | |
} | |
if(!input.val().match(/^[a-zA-Z0-9_-]+$/)){ | |
addMessage(input.parent(), 'Provided login contains invalid characters (letters, numbers, hyphen and underscore allowed)'); | |
return false; | |
} | |
$.get("isLoginAvailable/" + $("#login").val(), function(data){ |
This file contains 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
def findByEmail(email: String): Option[NativeUser] = { | |
DB.withConnection{ implicit connection => | |
SQL("SELECT id, firstName, lastName, email, password, hasAvatar FROM appUser WHERE email={email}").on('email -> email)().collectFirst { | |
case Row(id: Long, firstName: String, lastName: String, email: String, password: String, hasAvatar: Boolean) => NativeUser(anorm.Id(id), firstName, lastName, email, password, hasAvatar) | |
} | |
} | |
} |
This file contains 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
connect hr/hr; | |
set echo on | |
BEGIN | |
FOR i IN 1..50 LOOP | |
execute immediate 'select * from hr.employees where employee_id = 115'; | |
END LOOP; | |
END; | |
/ |
This file contains 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
run.sh |
OlderNewer