View useful-handy-command.sh
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
// tracking linux or ubuntu | |
sudo tail /var/log/apache2/error.log | |
// or macOS error log | |
/private/var/log/apache2/error_log | |
// check disk space in ubuntu | |
df -h | |
// Grep command to search into files | |
grep -lrnw '/root/Desktop/ipozal' -e 'geolocation' |
View aws-apigateway-lambda-with-multiple-stages.yaml
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
AWSTemplateFormatVersion: '2010-09-09' | |
Resources: | |
LambdaApiGatewayRestApi: | |
Type: AWS::ApiGateway::RestApi | |
Properties: | |
ApiKeySourceType: HEADER | |
Description: An API Gateway with a Lambda Integration | |
EndpointConfiguration: | |
Types: |
View cowin_tracker
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
import requests | |
import json | |
import os | |
import time | |
import datetime | |
print("Which search you would like to do ? 1. Pincode 2. State code") | |
choice = input() | |
currtime = datetime.datetime.now() | |
date = currtime.strftime("%d")+"-"+currtime.strftime("%m")+"-"+currtime.strftime("%Y") | |
if choice == '1': |
View php-guzzle-promise-function.php
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
<?php | |
use GuzzleHttp\Promise\Promise; | |
use GuzzleHttp\Promise\EachPromise; | |
function promiseFunction($sample_array,$index){ // index is optional params | |
$promise = new Promise( | |
function () use ($sample_array,$index,&$promise) { | |
$response = secondFunction($sample_array); |
View doc-pdf.py
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
import subprocess | |
subprocess.check_call( | |
[‘/usr/bin/python3’, ‘/usr/bin/unoconv’, ‘-f’, ‘pdf’, ‘-o’, pdffilename, ‘-d’, ‘document’, | |
newfilename]) | |
except subprocess.CalledProcessError as e: | |
print(‘CalledProcessError’, e) |
View tar-creation-s3-bucket.py
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
import boto3 | |
import tarfile | |
import os.path | |
s3Client = boto3.client('s3') | |
s3object = boto3.resource('s3') | |
def lambda_handler(event, context): | |
agtBucket = "angularbuildbucket" | |
key="" |
View Count lines in Git repo
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
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
$ git ls-files | xargs wc -l |
View deployment_angular_s3_cloudfront.py
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
#!/usr/bin/env python | |
""" | |
File : deployment_angular_s3_cloudfront.py | |
Package : | |
Description : | |
Created by Avinash on 18/09/2019 | |
""" | |
# git checkout production | |
# git fetch origin |
View search_subdirectory_s3_bucket.py
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
#Author : Avinash Dalvi | |
#Reference question : https://stackoverflow.com/questions/62158664/search-in-each-of-the-s3-bucket-and-see-if-the-given-folder-exists/62160218#62160218 | |
import boto3 | |
client = boto3.client('s3') | |
bucket_name = "bucket_name" | |
prefix = "" | |
s3 = boto3.client("s3") |
View gradle_help.txt
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
# Open /Users/UserName/Library/Application\ Support/Titanium/mobilesdk/osx/7.4.0.GA/android/templates/gradle/gradle/wrapper/gradle-wrapper.properties | |
replace this | |
distributionUrl=http\://services.gradle.org/distributions/gradle-4.6-all.zip | |
to | |
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
NewerOlder