Skip to content

Instantly share code, notes, and snippets.

View vishaldpatel's full-sized avatar

Vishal Patel vishaldpatel

View GitHub Profile
@vishaldpatel
vishaldpatel / aws_gaming_instance_setup.ps1
Last active March 27, 2026 22:40
This powershell script doesn't fully work without following some of the manual steps in the comments!
# 1: Start Powershell and run the following to log into AWS console to grab the nvidia drivers,
# and set the execution policy in order to run unsigned powershell scripts:
# Invoke-AWSLogin
# Set-ExecutionPolicy unrestricted
# 12 Install Chocolatey (The Package Manager)
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
@vishaldpatel
vishaldpatel / nginx.conf
Created October 29, 2024 23:37
Sample nginx config for the scenario where project specific configs will live inside sites-available / sites-enabled
#user http;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@vishaldpatel
vishaldpatel / project_domain_tld
Created October 29, 2024 23:33
Nginx config for our project that will live in sites-available
server {
listen 443 ssl;
server_name project_domain.tld www.project_domain.tld;
root /home/project_owner/my_awesome_project/priv/static;
ssl_certificate /etc/letsencrypt/live/project_domain_tld/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/project_domain_tld/privkey.pem;
access_log /var/log/nginx/foo.access.log main;
error_log /var/log/nginx/foo.error.log;
@vishaldpatel
vishaldpatel / update_ip.sh
Created March 22, 2024 20:29
Cloudflare IP address updater
#!/bin/bash
# Cloudflare API credentials
API_EMAIL="you@yourdomain.com"
API_KEY="cloudflaire_api_key_goes_here"
# Cloudflare zone and record details
ZONE_ID="ZONE_ID_GOES_HERE"
RECORD_NAME="DNS_RECORD_NAME_GOES_HERE"
@vishaldpatel
vishaldpatel / better_fib.exs
Created March 23, 2019 02:00
A fibonacci number generator that is pretty quick written in Elixir
defmodule BetterFib do
# Fib Calculator that pushes totals forward
def fib(num) when is_number(num) and num == 0, do: 0
def fib(num) when is_number(num) and num == 1, do: 1
def fib(num) when is_number(num) and num >= 2 do
numList = Enum.to_list(2..num)
fib(0, 1, num, numList)
end
/*
This is a simple JavaScript example that
covers a clean way to create:
Classes
Inheritance
Getters
Setters
Methods
and making use of them
*/