Skip to content

Instantly share code, notes, and snippets.

View manjeshpv's full-sized avatar
🇮🇳
in India

Manjesh V manjeshpv

🇮🇳
in India
  • LEADSchool.in
  • Bangalore
View GitHub Profile
@manjeshpv
manjeshpv / scrap-workable.com.js
Created November 22, 2018 09:36
scrap-workable.com.js
const fs = require('fs');
const urls = fs.readFileSync('./resources.workable.com.csv').toString().split('\n');
console.log('urls', urls)
const scrapeIt = require("scrape-it")
const out = [];
const loop = async( ) => {
for (let i=0; i<10;i++) {
@manjeshpv
manjeshpv / owncloud10-one-click.sh
Created January 31, 2018 05:59
Installing OwnCloud 10 in Ubuntu 16.04
#!/bin/bash
USER=manjeshpv
HOSTNAME=drive.manjeshpv.com
# using root user
apt update
apt upgrade
yum install nginx php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip-y
echo "Changing SELinux Settings"
sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
echo "Enabling SELinux Disabled config"
sestatus && chmod +x init.sh && ./init.sh
@manjeshpv
manjeshpv / mailtrain-postal-bounce.diff
Created September 20, 2017 14:51
webhooks from postal bounced email for mailtrain
diff --git a/lib/models/links.js b/lib/models/links.js
index e7ce559..aabc9ab 100644
--- a/lib/models/links.js
+++ b/lib/models/links.js
@@ -277,7 +277,7 @@ module.exports.updateLinks = (campaign, list, subscription, serviceUrl, message,
if (!campaign.openTrackingDisabled) {
let inserted = false;
let imgUrl = urllib.resolve(serviceUrl, util.format('/links/%s/%s/%s', campaign.cid, list.cid, encodeURIComponent(subscription.cid)));
- let img = '<img src="' + imgUrl + '" width="1" height="1" alt="mt">';
+ let img = '<img src="' + imgUrl + '" width="1" height="1" alt="">';
const json2csv = (list, headers) => [headers]
.concat(list)
.map(row => Object
.values(row)
.join(','))
.join('\n');
{
"name": "api",
"version": "0.0.1",
"main": "server/app.js",
"dependencies": {
},
"devDependencies": {
"precommit-hook": "^3.0.0"
},
// express.js
app.use((req, res, next) => {
req.v2 = req.get('version') === '2'
return next();
})
app.get('/securedapi', (req, res) => {
if(req.v2)
//new logic
/***
* types
* - csv http stream -> db | pros: no space or memory usage but user need to wait and high db load on more concurrency
* - http csv stream -> temp file -> read stream -> db | cons: high db load on high concurrency
* - http csv stream -> temp file -> queue(read stream -> db) | highly robust
*/
var http = require('http'),
path = require('path'),
os = require('os'),
#!/bin/sh
/sbin/modprobe nf_conntrack_ftp 2>&1 >/dev/null
IPTABLES='/sbin/iptables'
# policy
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F
$IPTABLES -X
$IPTABLES -Z
@manjeshpv
manjeshpv / sha512.js
Created January 27, 2017 06:15
sha512 Nodejs crypto
const crypto = require('crypto');
const hashedPass = crypto
.createHash('md5')
.update('manjesh')
.digest('hex');
console.log(hashedPass);