Skip to content

Instantly share code, notes, and snippets.

View aqkhan's full-sized avatar
☠️
Testing in prod.

AK aqkhan

☠️
Testing in prod.
  • AlphaSquad
View GitHub Profile
@aqkhan
aqkhan / nvm_node_pm2_install.sh
Last active April 11, 2025 12:26
Install NVM, Nodejs, and pm2 on ubuntu.
#!/bin/bash
# Function to install nvm
install_nvm() {
echo "Installing NVM..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Source nvm script to make nvm command available in the current session
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
@aqkhan
aqkhan / docker-compose.yml
Created February 2, 2023 19:51
Opensearch & Openseach Dashboard
version: '3'
services:
opensearch_container:
container_name: opensearch_container
image: opensearchproject/opensearch:latest
ports:
- "9200:9200"
- "9300:9300"
environment:
cluster.name: opensearch_cluster # Name of the cluster
@aqkhan
aqkhan / ask.sh
Last active March 20, 2023 16:20
Install nginx, git, nvm, node, yarn, and PM2 on Amazon Linux 2
#!/bin/bash
# Create the file
nano ask.sh
# Paste the contents of the file
# Give permissions to the shell script
chmod +x ask.sh
@aqkhan
aqkhan / uploadFIlenodeJs
Created July 25, 2022 09:38
Nodejs file upload
app.post('/google-bulk-create', async (req, res) => {
try {
// No file uploaded
if(!req.files) {
res.send({
status: false,
message: 'No file uploaded'
});
const mysql = require("mysql");
const dotenv = require("dotenv");
dotenv.config();
// Create a connection to the database
const connection = mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
const resolvers = {
Query: {
findAllCustomers: async (_, args, context) =>
await context.models.customerModel.queries.findAllCustomers(),
},
Mutation: {
addCustomer: async (_, args, context) =>
await context.models.customerModel.mutations.addCustomer(
JSON.parse(JSON.stringify(args.newCustomer))
),
const { gql } = require("apollo-server-express");
const typeDefs = gql`
type Customer {
id: ID
email: String
name: String
active: Boolean
}
type Query {
const { gql } = require("apollo-server-express");
const typeDefs = gql`
type Customer {
id: ID
email: String
name: String
active: Boolean
}
type Query {
const { gql } = require("apollo-server-express");
const typeDefs = gql`
type Customer {
id: ID
email: String
name: String
active: Boolean
}
`;
@aqkhan
aqkhan / lightsail-docker.sh
Last active January 13, 2021 17:26 — forked from Jeiwan/lightsail-docker.sh
Auto-Install Docker and Docker Compose on AWS Lightsail
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y docker-engine
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo groupadd docker