Skip to content

Instantly share code, notes, and snippets.

View saman-taghavi's full-sized avatar

saman saman-taghavi

View GitHub Profile
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgres:alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
PGDATA: /data/postgres
# be sure to make a docker netwrok named nginx-proxy
version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
expose:
- 81
ports:
- '80:80' # Public HTTP Port
##
# docker-compose up [-d]
# docker-compose down
# docker network create nginx-proxy
##
version: '3.5'
networks:
inception-net:
nginx-proxy:
name: nginx-proxy
@saman-taghavi
saman-taghavi / changeDns.js
Created September 22, 2023 09:34
scriptKit set and reset dns for mac, set dns to shcean dns
// Name: change DNS mac
import "@johnlindquist/kit";
// Define the DNS servers you want to set
const dnsServer1 = "185.51.200.2";
const dnsServer2 = "178.22.122.100";
// Function to change DNS settings
async function changeDNS() {
@saman-taghavi
saman-taghavi / gitHash.js
Created July 1, 2023 12:29
get git hash in node
revision = require("child_process")
.execSync("git rev-parse HEAD")
.toString()
.trim();
@saman-taghavi
saman-taghavi / atomWithBroadCast.ts
Created June 24, 2023 16:49
atomWithBroadCast.ts
import { atom } from "jotai";
const strAtom = atom(""); // primitive string atom
export function atomWithBroadcast<Value>(key: string, initialValue: Value) {
const channel = new BroadcastChannel(key);
const baseAtom = atom(initialValue);
const listeners = new Set<(event: MessageEvent<any>) => void>();
const broadcastAtom = atom<
@saman-taghavi
saman-taghavi / mysql-docker.sh
Created September 22, 2022 07:29 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@saman-taghavi
saman-taghavi / removeCortana.ps
Created June 1, 2022 14:12
remove cortana from win 10
Get-AppxPackage -allusers Microsoft.549981C3F5F10 | Remove-AppxPackage
@saman-taghavi
saman-taghavi / profile.ps1
Created January 13, 2022 17:57
Well this is how i set up my powershell profile for ohmypwsh and auto complete for powershell 7
Set-Item -Path Function:prompt -Value $Prompt -Force
# get all themes
$themes = Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name
# get a rendom theme
$theme = Get-Random -InputObject $themes.Name
# initiate ohmyposh
oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/$theme | Invoke-Expression
# these are for auto complete of commands previously used
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
@saman-taghavi
saman-taghavi / copyPub.ps1
Last active October 1, 2021 08:04
copy ssh pub to server for windows pwsh kudos to Christopher Hart
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh {IP-ADDRESS-OR-FQDN} "cat >> .ssh/authorized_keys