Skip to content

Instantly share code, notes, and snippets.

View vodolaz095's full-sized avatar

Остроумов Анатолий vodolaz095

View GitHub Profile
@vodolaz095
vodolaz095 / cryptoGetHashed.js
Created May 5, 2014 18:31
Get hashing algorithms, that are currently in use by onboard nodejs module of crypto
var crypto = require('crypto');
console.log(crypto.getHashes());
@vodolaz095
vodolaz095 / redbook.sh
Last active August 29, 2015 14:00
Script to retrieve and store RedNoteBook data files in private git repository
#!/bin/bash
if [ ! -f ~/.rednotebook/recent.lock ]; then
echo 'Pulling from remote repo...'
cd ~/.rednotebook/data
git pull
touch ~/.rednotebook/recent.lock
else
echo 'Pushing to remote repo...'
cd ~/.rednotebook/data
@vodolaz095
vodolaz095 / fib.js
Created March 4, 2014 18:18
Fibonacci function
function fib(x){
if(x>=0){
switch(x){
case 0:
return 1;
break;
case 1:
return 1;
break;
default:
@vodolaz095
vodolaz095 / tea.sh
Last active August 29, 2015 13:56
Bash script that helps me make tea - timer with notify-send notifications, work with LXDE desctop
#!/bin/bash
if [ $1 ]
then
echo "Setting timer for $1 minutes";
DELAY=$(echo "scale=4; $1*60+1" | bc)
DTS=$(date +%H:%M:%S)
(sleep $DELAY; notify-send "TeaHelper by Vodolaz095" "$DTS : Tea is ready!") &
else
echo 'Enter how many minutes to wait for tea to be ready'
@vodolaz095
vodolaz095 / nginx.conf
Last active January 13, 2016 18:49
NGINX Config for nodejs application with nginx serving assets and socket.io support
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
# * https://gist.github.com/vodolaz095/8373960
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
@vodolaz095
vodolaz095 / cryptoVSmhashBench.js
Last active December 30, 2015 04:29
Crypto vs mhash for hashing some long string
var fs = require('fs'),
crypto = require('crypto'),
mhash = require('mhash').hash, //$ npm install mhash
crc32 = require('buffer-crc32'), //$ npm install buffer-crc32
async = require('async'); //$ npm install async
console.log('Reading file');
var content = fs.readFileSync('./download.htm');
@vodolaz095
vodolaz095 / index.js
Last active December 29, 2015 16:38
Working yahoo - oauth - nodejs example
//works on nodejs of 0.10.22
//the WORKING code from there http://developer.yahoo.com/boss/geo/docs/codeexamples.html#oauth_js
//i think YAHOO have to test code before posting
var OAuth = require('oauth'), // `$ npm install oauth`
qs = require('querystring');
function yahooSearch(consumerKey, consumerSecret, query, count, callback){
@vodolaz095
vodolaz095 / Pound.cfg
Last active December 27, 2015 20:28
Pound.cfg
User "pound"
Group "pound"
LogLevel 0
LogFacility -
Alive 1
TimeOut 10
ListenHTTP
Address 0.0.0.0
xHTTP 1
@vodolaz095
vodolaz095 / gist:6437416
Created September 4, 2013 14:07
Unpack all archives by 1 command
#.bashrc
# Command «unpack»
unpack ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvJf $1 ;;
*.bz2) bunzip2 $1 ;;
@vodolaz095
vodolaz095 / index.js
Created September 4, 2013 09:40
expressJS example for waterfall style routing
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('hello world, this is route 1');
});
app.get('/', function(req, res){
res.send('hello world, this is route 2');
});