The various approach followed for upload service
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 | |
function array_table_innerjoin(Array $leftArr, Array $rightArr, String $key) { | |
$mergeArray = []; | |
foreach($leftArr as $leftRow) { | |
foreach($rightArr as $rightRow) { | |
if(isset($leftRow[$key]) && isset($rightRow[$key]) && $leftRow[$key] == $rightRow[$key]) { | |
$mergeArray[] = array_merge($leftRow, $rightRow); | |
} | |
} |
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
// Daily | |
awk '{print $4}' /var/log/apache2/$1/access.log | cut -d: -f1 | uniq -c | |
// Hourly | |
grep "`date +%d/%b/%Y`" /var/log/apache2/$1/access.log | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":00"}' | sort -n | uniq -c | |
// IP-Based | |
grep 'text' /var/log/apache2/$1/access.log | cut -d' ' -f1 | sort | uniq -c | sort -r |
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
#!/bin/sh | |
# src details | |
SRCPATH='/path/of/target' | |
SRCFILE='file-or-directory' | |
# s3 details | |
S3BUCKET='bucketname' | |
S3PATH='path/in/bucket' | |
S3REGION='us-east-1' | |
TMPDIR='/tmp/s3' |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListBucket" | |
], | |
"Resource": [ | |
"arn:aws:s3:::example.com" |
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
<RoutingRules> | |
<RoutingRule> | |
<Condition> | |
<KeyPrefixEquals/> | |
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals> | |
</Condition> | |
<Redirect> | |
<Protocol>https</Protocol> | |
<HostName>xxx1x11xxx.execute-api.us-east-1.amazonaws.com</HostName> | |
<ReplaceKeyPrefixWith>prod/convert?key=</ReplaceKeyPrefixWith> |
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
# Schema Spy | |
java -jar /usr/local/bin/schemaSpy_5.0.0.jar -dp /home/androbabu/softwares/jar/mysql-connector-java-5.1.28.jar -t mysql -host localhost -db $1 -u root -p password -o .schema | |
# Git Tree Log | |
git log --graph --all --pretty=format:"%C(auto)%h%d %s %C(dim)(%an) %aD" | |
git config --global alias.tree 'log --graph --all --pretty=format:"%C(auto)%h%d %s %C(dim)(%an) %aD"' | |
git tree |
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
resources: | |
Resources: | |
TestOneBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: ${self:service}-${self:provider.region}-test-one | |
CorsConfiguration: | |
CorsRules: | |
- AllowedOrigins: ['*'] | |
AllowedHeaders: ['*'] |
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
/** | |
* Usage: var json = $('#form-login').serializeObject(); | |
* Output: {username: "admin", password: "123456"} | |
* Output: {username: "admin", password: "123456", subscription: ["news","offer"]} | |
* */ | |
$.fn.serializeObject = function() { | |
var obj = {}; | |
var arr = this.serializeArray(); | |
arr.forEach(function(item, index) { |
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
// source: https://gist.github.com/chinchang/8106a82c56ad007e27b1#file-xmltojson-js | |
function xmlToJson(xml) { | |
if (typeof xml === 'string') { | |
parser = new DOMParser(); | |
xml = parser.parseFromString(xml, 'text/xml'); | |
} | |
// Create the return object | |
var obj = {}; |
OlderNewer