Skip to content

Instantly share code, notes, and snippets.


Kunal Yadav abkunal

View GitHub Profile
abkunal /
Last active Jan 2, 2021
CDK configuration to create a custom VPC
from aws_cdk.aws_ec2 import RouterType, CfnSecurityGroup
# basic VPC configs
VPC = 'custom-vpc'
INTERNET_GATEWAY = 'internet-gateway'
KEY_PAIR_NAME = 'us-east-1-key'
REGION = 'us-east-1'
abkunal /
Created Jan 2, 2021
CDK Stack file to create a custom VPC
from aws_cdk import core
from aws_cdk.aws_ec2 import Vpc, CfnRouteTable, RouterType, CfnRoute, CfnInternetGateway, CfnVPCGatewayAttachment, \
CfnSubnet, CfnSubnetRouteTableAssociation, CfnSecurityGroup, CfnInstance
from . import config
class VpcStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
abkunal / uwsgi.service
Created Oct 21, 2020
UWSGI service file for systemd
View uwsgi.service
Description=uWSGI Emperor service
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown ubuntu:www-data /run/uwsgi'
ExecStart=/home/ubuntu/virtualenvs/myenv/bin/newrelic-admin run-program /home/ubuntu/virtualenvs/myenv/bin/uwsgi --emperor /etc/uwsgi/sitesRestart=always
abkunal / uwsgi.conf
Created Oct 21, 2020
UWSGI configuration file for Supervisor
View uwsgi.conf
command=/home/ubuntu/virtualenvs/myenv/bin/newrelic-admin run-program
-H /home/ubuntu/virtualenvs/myenv
-s /home/ubuntu/myapp/myapp_uwsgi.sock
--chown-socket ubuntu
abkunal / apm-server.yml
Created Oct 21, 2020
APM server configuration file
View apm-server.yml
# APM server 7.1.1
# run "locate apm-server.yml" to find file's location on server
# allows the internet to send data to the apm server. 5700 is the port exposed by the apm server
host: ""
# denotes the maximum size of a single event in bytes that can be processed by the APM server.
# if an event size is greater than the configured then that event is dropped
max_event_size: 1457600
View otp.js
const http = require('http');
function sendOTP (phone, callback) => {
let path = '/api/sendotp.php?otp_length=6&authkey=' + OTP_AUTH_KEY +
'&message=&sender=MySHIK&mobile=+91'+ phone +'&otp_expiry=5';
path = encodeURI(path);
let options = {
'method': 'POST',
'hostname': '',
View countries.json
"nodes": [
{ "country": "East Timor", "code": "tl" },
{ "country": "Canada", "code": "ca" },
{ "country": "Turkmenistan", "code": "tm" },
{ "country": "United States of America", "code": "us" },
{ "country": "Lithuania", "code": "lt" },
{ "country": "Cambodia", "code": "kh" },
{ "country": "Ethiopia", "code": "et" },
{ "country": "Swaziland", "code": "sz" },
View world_countries.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bar chart.html
body {
text-align: center;
<script src=""></script>
<script src=""></script>
View miserables.json
"nodes": [
{"id": "Myriel", "group": 1},
{"id": "Napoleon", "group": 1},
{"id": "Mlle.Baptistine", "group": 1},
{"id": "Mme.Magloire", "group": 1},
{"id": "CountessdeLo", "group": 1},
{"id": "Geborand", "group": 1},
{"id": "Champtercier", "group": 1},
{"id": "Cravatte", "group": 1},