Skip to content

Instantly share code, notes, and snippets.

View Parassharmaa's full-sized avatar
🎯
Focusing

Paras Sharma Parassharmaa

🎯
Focusing
View GitHub Profile
@Parassharmaa
Parassharmaa / updwn.py
Last active July 21, 2018 16:52
Ups and Down Sequence
'''
Count number of possible ways to create a sequence with following property
(1 3 4) "5" (4 2)
-- First part: Increasing
-- Second part: decreasing
'''
# no. of array items
@Parassharmaa
Parassharmaa / git.md
Last active May 22, 2018 12:29
Git Commands
$ git init

$ git status

$ git add 

$ git diff

$ git remote add origin 
@Parassharmaa
Parassharmaa / Instructions.md
Created March 8, 2018 18:28
Deployment Instructions

Repo's

  • dashboard-api/
  • dashboard-web/
  • homepage-web/
  • mobile-app/

Requirements

  • Git
  • SSH
@Parassharmaa
Parassharmaa / setup.sh
Created March 5, 2018 16:12
Nginx Setup
sudo apt-get update
sudo apt-get install nginx
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
@Parassharmaa
Parassharmaa / PD.java
Last active February 21, 2018 17:54
Parallel Dots
import java.io.*;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import javax.net.ssl.HttpsURLConnection;
@Parassharmaa
Parassharmaa / 01_kms_encrypt.py
Last active August 8, 2023 13:54
AWS KMS (Encryption and Decryption)
import boto3
import base64
kms = boto3.client('kms')
keyId = kms.create_key()['KeyId']
# to encrypt data less than 4KB (usually for secret and access tokens)
randomData = 'Hello world'
@Parassharmaa
Parassharmaa / BowTie.java
Last active February 13, 2018 11:22
Practice: Java Programs
public class BowTie {
public static void main(String args[]) {
int n = Integer.parseInt(args[0]);
for(int i=0; i<2*n+1; i++) {
for(int j=0; j<2*n+1; j++) {
if ((j>i && j<2*n-i) || (j>(2*n-i) && j<i && i>n))
System.out.print(" . ");
else
System.out.print(" * ");
}
@Parassharmaa
Parassharmaa / Settings.js
Created January 22, 2018 10:46
React Settings UI/UX
import React, { Component } from 'react';
import { AppRegistry, TextInput, View,Text, StyleSheet, Switch, TouchableOpacity } from 'react-native';
export default class UselessTextInput extends Component {
constructor(props) {
super(props);
this.state = {
emailOpt: true,
pushOpt: true
};
@Parassharmaa
Parassharmaa / export_mongodb.py
Last active January 21, 2023 16:34
Python script to export MongoDB collections to JSON file
import os
host = ""
username = ""
password = ""
directory_to_export = ""
database = ""
all_collections = []
@Parassharmaa
Parassharmaa / conf
Created December 16, 2017 09:12
Configuration for reverse proxy nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name <domain_name>.com www.<domain_name>.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;