Skip to content

Instantly share code, notes, and snippets.

View prakashcc's full-sized avatar

Prakash Choudhary prakashcc

View GitHub Profile
@prakashcc
prakashcc / photos-v1.json
Created September 28, 2024 06:18 — forked from stewartmcgown/photos-v1.json
Google Photos API v1 Internal
{
"canonicalName": "Photos Library",
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/photoslibrary": {
"description": "View and manage your Google Photos library"
},
"https://www.googleapis.com/auth/photoslibrary.readonly": {
"description": "View your Google Photos library"
{
"title": "Takeout API",
"discoveryVersion": "v1",
"ownerName": "Google",
"version_module": true,
"resources": {
"exports": {
"methods": {
"get": {
"flatPath": "v2/{service}/exports/{exportId}",
#!/bin/bash
for f in $(find / -name "*.jar" 2>/dev/null); do
#echo "Checking $f..."
unzip -l "$f" | grep -F org/apache/logging/log4j/core/lookup/JndiLookup.class
if [ $? -eq 0 ]; then
echo "Found JNDI lookup class in $f in $container. Deleting now..."
zip -q -d $f org/apache/logging/log4j/core/lookup/JndiLookup.class
#find / -name "log4j-core-2*.jar" -exec zip -q -d {} org/apache/logging/log4j/core/lookup/JndiLookup.class \;
fi
@prakashcc
prakashcc / gist:526430f783c6187f5acf92a506d0dd4c
Created December 13, 2021 07:13
Error: Cannot install in Homebrew on ARM processor
This issue with new macbook M1 chip
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
For Resolve follow below steps
Step1
$ brew bundle dump
@prakashcc
prakashcc / example.com
Created April 25, 2019 09:20 — forked from 1hakr/example.com
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@prakashcc
prakashcc / nginx-tuning.md
Created January 25, 2019 12:18 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@prakashcc
prakashcc / cluster.md
Created January 19, 2019 11:45 — forked from learncodeacademy/cluster.md
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
@prakashcc
prakashcc / mongobackup.sh
Created August 28, 2018 06:36 — forked from erans/mongobackup.sh
MongoDB ReplicaSet Backup Script on Google Compute Engine and Google Cloud Storage
# Path to boto config file, needed by gsutils
BOTO_CONFIG="/etc/boto.cfg"
# Path in which to create the backup (will get cleaned later)
BACKUP_PATH="/mnt/data/dump/"
# DB name
DB_NAME="mydatabase"
# Google Cloud Storage Bucket Name
@prakashcc
prakashcc / wildfly-install.sh
Created August 11, 2018 10:44 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2016-06-18T02:45-0700
#usage :/bin/bash wildfly-install.sh
#tested-version1 :10.0.0.CR3
#tested-distros1 :Ubuntu 15.10; Debian 7,8; CentOS 7; Fedora 22
#tested-version2 :10.0.0.Final
@prakashcc
prakashcc / ERC20.sol
Created February 10, 2018 14:36 — forked from anonymous/ERC20.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
pragma solidity ^0.4.16;
interface ERC20 {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);