Skip to content

Instantly share code, notes, and snippets.

View arvsr1988's full-sized avatar

Arvind Sridharan arvsr1988

  • Chennai
View GitHub Profile
#auto adjusting column width of cells for openpyxl 3.0
for column_cells in ws.columns:
unmerged_cells = list(filter(lambda cell_to_check: cell_to_check.coordinate not in ws.merged_cells, column_cells))
length = max(len(str(cell.value)) for cell in unmerged_cells)
ws.column_dimensions[unmerged_cells[0].column_letter].width = length * 1.2
@arvsr1988
arvsr1988 / aws_api_gateway_http_proxy_integration.json
Created October 1, 2019 10:53
swagger definition for a http proxy integration on the AWS api gateway.
{
"/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json"
],
"parameters": [
{
"name": "proxy",
"in": "path",
@arvsr1988
arvsr1988 / DockerFile_node
Created July 14, 2017 13:18
docker script for node app
#how to run app in docker
#docker build -t <name> .
#docker run -p 3000:3000 <name>
FROM node:6-alpine
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
@arvsr1988
arvsr1988 / deploy_node_app.sh
Created September 22, 2016 06:44
deploying a node app using a CI system to a new directory.
#bin/bash
CURRENT_DATE=`date +%s`
echo "current date is $CURRENT_DATE"
DEPLOYMENT_DIR='{deployment directory}'
CURRENT_DEPLOYMENT_DIR=$DEPLOYMENT_DIR$CURRENT_DATE
ARTIFACT_ZIP_LOCATION=~/tmp/
echo "current deployment dir $CURRENT_DEPLOYMENT_DIR"
PM2_PROCESS_NAME='{process name}'
mkdir -p $CURRENT_DEPLOYMENT_DIR
cp $ARTIFACT_ZIP_LOCATION/web.tar.gz $CURRENT_DEPLOYMENT_DIR
@arvsr1988
arvsr1988 / gmail_send_api_notworking.js
Created September 21, 2016 12:30
gmail api integration
var google = require('googleapis');
var googleAuth = require('google-auth-library');
var mimelib = require("mimelib");
let btoa = require('btoa');
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json
var SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/gmail.send'];
var key = require('./client_secret.json');
var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, SCOPES, null);
@arvsr1988
arvsr1988 / node_module_copier.js
Last active December 27, 2017 07:52
Copy node modules from your dependencies recursively to your artifact directory using this code. This will work with npmjs version 3 and node js version 6(supporting ES 6)
let shell = require('shelljs');
const path = require('path');
const rootDir = path.resolve('./');
const alreadyCopied = (module, deployDir) => {
return shell.test('-d', deployDir + '/node_modules/' + module);
}
function copyDeps(packageFile, deployDir){
let moduleDeps = require(packageFile).dependencies;