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
var irc = require('irc'), | |
http = require('http');//, | |
//ircsync = require('ircsync'); | |
var bot = new irc.Client('irc.freenode.net', 'minelitecoin-bot', {channels: ['#mine-litecoin']}); | |
bot.addListener('message', function(from, to, message){ | |
if(message == '?help'){ | |
bot.say('#mine-litecoin', 'If you need help with getting started visit http://mine-litecoin.com/index.php?page=getting%20started'); | |
} |
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
sync; mysqldump -uroot -pPasswordhere database > /path/to/backup/database-$(date "+%Y.%m.%d-%H").sql |
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
var connection = mysql.createConnection(dbconfig); | |
function doExist(data, callback){ | |
connection.connect(); | |
connection.query('select * from testaccount where username=?',[data.username], function(err,rows){ | |
//if(err) throw err; | |
console.log(rows); | |
if(rows[0].username){ | |
callback(true); | |
}else{ |
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
app.get('/img/:x/:y/:name', function(req,res){ | |
var x = req.params.x, | |
y = req.params.y; | |
var sub = req.params.name.split('.'), | |
name = sub[sub.length-2], | |
ext = sub[sub.length-1]; | |
var d1 = ['/path/to/',name,'.',ext]; | |
fs.exists(d1.join(""), function(exist){ | |
if(exist){ | |
var image = Canvas.Image, |
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
app.get('/img/:width/:height/:name', function(req,res){ | |
var name = req.params.name; | |
var sub = name.split('.'),fname = sub[sub.length-2],ext = sub[sub.length-1]; | |
var d1 = ['/path/to/',fname,'.',ext]; | |
fs.exists(d1.join(""), function(exist){ | |
if(exist){ | |
var img = new image; | |
console.log(d1.join('')); | |
img.onerror = function(err){ |
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
module.exports = { | |
index:function(req,res){//get /test in routes.js | |
res.view('test'); | |
}, | |
upload:function(req,res){//post /upload in routes.js | |
console.log(req.files.uploadfile); | |
var path = '/home/projects/upload/'+req.files.uploadfile.name; | |
require('fs').rename(req.files.uploadfile.path,path,function(err){ | |
if(err) throw err; | |
fs.chmodSync(path,440);//for *nix systems |
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
module.exports = { | |
index: function(req,res){ | |
var name = req.params.name; | |
var sub = name.split('.'),fname = sub[sub.length-2],ext = sub[sub.length-1]; | |
var imgpath = __dirname+'/../../assets/img/'+fname+'.'+ext; | |
require('fs').exists(imgpath, function(exist){ | |
if(exist){ | |
var Canvas = require('canvas'), | |
Image = Canvas.Image, |
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
# | |
#Generic Kickstart template for Ubuntu | |
#Platform: x86 and x86-64 | |
# | |
# Customized for Server 14.04 minimal vm install | |
# | |
# Usage: | |
# - Look through config for any changes you want to do. You may want to change | |
# the initial admin user. Currently username is ubuntu and password is | |
# ChangeMe. Also may want to change the list of installed packages. Tried to |
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
use std::net::Ipv4Addr; | |
pub struct IPv4Network { | |
pub ip: Ipv4Addr, | |
pub prefix: u8 | |
} | |
pub struct IPv4Iter { | |
pub state: Ipv4Addr, |