Skip to content

Instantly share code, notes, and snippets.

View Sanjay007's full-sized avatar
🎯
Focusing

Sanjay Y Sanjay007

🎯
Focusing
View GitHub Profile
@Sanjay007
Sanjay007 / gist:3fcb404784915e5b150c8270494a27ae
Created March 25, 2023 05:37
Compress Image using Nodejs to 100KB
const sharp = require('sharp');
const fs = require('fs');
sharp('path/to/input/image.jpg')
.jpeg({ quality: 80 })
.resize({ width: 800 })
.toBuffer((err, buffer) => {
if (err) throw err;
if (buffer.length > 100 * 1024) {
@Sanjay007
Sanjay007 / Setup Virtual Host Ubuntu Commands
Last active December 19, 2022 08:13
Setup Virtual Host Ubuntu Using Apache2
sudo mkdir -p /var/www/inhireapp.com/public_html
sudo chown -R $USER:$USER /var/www/inhireapp.com/public
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf'
<VirtualHost *:80>
@Sanjay007
Sanjay007 / Readme.md
Last active August 20, 2021 04:17
Node JS Docker Example With MongoDB

Dockerfile

FROM node:latest

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY package.json /usr/src/app

const mongoose = require("mongoose");
const DB_URL = process.env.MONGO_URI;
module.exports = () => {
const connect = () => {
mongoose.Promise = global.Promise;
mongoose.connect(
DB_URL,
{
keepAlive: true,
@Sanjay007
Sanjay007 / nginx-upstream-angular-nodejs-domain-config
Created December 31, 2020 11:40
Configure Free SSL Nginx , Centos 7 , Go Daddy Domain On VPS . Configure Nginx With Angular and NodeJS Backend
upstream notes{
server 178.37.152.51:3000;
}
upstream backapi{
server 187.37.152.51:8443;
}
#limit_req_zone $binary_remote_addr zone=one:50m rate=20r/s;
@Sanjay007
Sanjay007 / fetchData.js
Last active August 19, 2021 14:21
How to Fetch Data From API in Next JS
static getInitialProps = async function() {
const catreq = [
"World",
"Country",
"Sports",
"Health",
"EntertaintMent",
"Business",
const puppeteer = require('puppeteer');
var fs = require("fs");
const FORM_SELECTOR='form div>div input';
const SUGGESTION_SELECTOR='form div>div ul>li';
async function run() {
const browser = await puppeteer.launch({headless: false}); // default is true
const page = await browser.newPage();
const puppeteer = require('puppeteer');
var fs = require("fs");
const FORM_SELECTOR='form div>div input';
const SUGGESTION_SELECTOR='form div>div ul>li';
async function run() {
const browser = await puppeteer.launch({headless: false}); // default is true
const page = await browser.newPage();
@Sanjay007
Sanjay007 / 1MarkerAnimation.java
Created October 6, 2018 20:51 — forked from broady/1MarkerAnimation.java
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
@Sanjay007
Sanjay007 / README.md
Created April 7, 2017 13:19 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/