Skip to content

Instantly share code, notes, and snippets.

View onel0p3z's full-sized avatar
🏠
Working from home

Juan Lopez onel0p3z

🏠
Working from home
View GitHub Profile
@frytaz
frytaz / gist:7037771
Last active December 25, 2015 20:49
Ghost node.js blogging platform password reset script
var bcrypt = require('bcrypt-nodejs'),
sqlite3 = require('sqlite3').verbose();
var file = 'content/data/ghost-dev.db';
var db = new sqlite3.Database(file);
var password = 'YOUR_NEW_PASSWD';
bcrypt.hash(password, null, null, function(err, hash) {
db.serialize(function() {
db.run("UPDATE users SET password = ? WHERE id = ?", hash, 1);
@julianduque
julianduque / db.js
Last active December 21, 2015 11:29 — forked from anonymous/db.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/app');
var usrSchema = new mongoose.Schema({
user: { type: String, required: true },
password: { type: String, required: true },
DLU: { type: Date }
});
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.
@onel0p3z
onel0p3z / image-getter.js
Created April 24, 2013 23:12
Parses HTML files in folder "Templates", looks for IMG tags, gets SRC attribute, and downloads images to current folder. Not the best way but it worked for me. Also can create a file with links of images. //TIPS from http://maxogden.com/scraping-with-node.html
var $ = require('cheerio'),
_ = require('underscore'),
request = require('request'),
// If you want to create a file
images = [],
path = require('path'),
dir = path.join(__dirname,'\Templates'),
fs = require('fs'),
GetImage = function(file){
var HtmlFile = fs.readFileSync(file).toString(),
@buritica
buritica / jshangouts-pruebas.md
Last active December 16, 2015 07:49
Vinculos sobre lo que hablamos en #JShangouts de pruebas el 16 de Abril
@vodolaz095
vodolaz095 / print.js
Last active August 30, 2023 20:47
Print for NodeJS using CUPS backend
var ipp = require('ipp'); //get it from there - https://npmjs.org/package/ipp - $npm install ipp
var request = require('request'); //get it from there - https://npmjs.org/package/request - $npm install request
var fs = require('fs');
function getPrinterUrls(callback) {
var CUPSurl = 'http://localhost:631/printers';//todo - change of you have CUPS running on other host
request(CUPSurl, function (error, response, body) {
if (!error && response.statusCode == 200) {
var printersMatches = body.match(/<TR><TD><A HREF="\/printers\/([a-zA-Z0-9-^"]+)">/gm);//i know, this is terrible, sorry(
var printersUrls = [];
@VRMink
VRMink / gist:5169211
Last active January 6, 2020 20:31
How to setup a private node.js web server with SSL authorization

Secure private web server with NodeJS

This article will explain how to set up a secure web server with NodeJS which only accepts connection from users with SSL certificates that you have signed. This is an efficient way to ensure that no other people are able to access the web server, without building a login system which will be significantly weaker.

I will not explain how to create a certificate authority (CA), create certificates or sign them. If you need to read up on this, have a look at this excelent article on how to do it with OpenSSL (Mac and Linux): https://help.ubuntu.com/community/OpenSSL#Practical_OpenSSL_Usage It is also possible to do this on a Mac with the keychain application, and I assume it is possible on a Windows machine aswell.

This architecture will allow you to have one web server communicating with an array of trusted clients, the web server itself can be on the public internet, that will not decrease the level of security, but it will only ser

@magnetikonline
magnetikonline / README.md
Last active August 9, 2017 21:53
Creating a remote Git repository.
@digitaljhelms
digitaljhelms / gist:4287848
Last active June 11, 2024 22:12
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@max-mapper
max-mapper / readme.md
Last active October 12, 2015 10:17
introduction to node