Skip to content

Instantly share code, notes, and snippets.

View abkunal's full-sized avatar

Kunal Yadav abkunal

View GitHub Profile
@abkunal
abkunal / config.py
Last active January 2, 2021 15:24
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
abkunal / vpc_stack.py
Created January 2, 2021 15:05
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
abkunal / uwsgi.service
Created October 21, 2020 07:24
UWSGI service file for systemd
## https://levelup.gitconnected.com/integrating-new-relic-apm-with-uwsgi-1dedcd0f92ff
[Unit]
Description=uWSGI Emperor service
[Service]
Environment="NEW_RELIC_CONFIG_FILE=/home/ubuntu/myapp/myapp/newrelic.ini"
Environment="NEW_RELIC_ENVIRONMENT=production"
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
abkunal / uwsgi.conf
Created October 21, 2020 07:15
UWSGI configuration file for Supervisor
## https://levelup.gitconnected.com/integrating-new-relic-apm-with-uwsgi-1dedcd0f92ff
[program:uwsgi]
user=root
command=/home/ubuntu/virtualenvs/myenv/bin/newrelic-admin run-program
/home/ubuntu/virtualenvs/myenv/bin/uwsgi
-H /home/ubuntu/virtualenvs/myenv
-s /home/ubuntu/myapp/myapp_uwsgi.sock
-C
--chown-socket ubuntu
@abkunal
abkunal / apm-server.yml
Created October 21, 2020 06:58
APM server configuration file
# APM server 7.1.1
# run "locate apm-server.yml" to find file's location on server
apm-server:
# 0.0.0.0 allows the internet to send data to the apm server. 5700 is the port exposed by the apm server
host: "0.0.0.0:5700"
# 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
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': 'control.msg91.com',
{
"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" },
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<style>
body {
text-align: center;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.0.0.min.js"></script>
<script>
{
"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},