Skip to content

Instantly share code, notes, and snippets.

@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active November 16, 2023 00:40
How to copy production database on AWS RDS(postgresql) to local development database.
View how-to-copy-aws-rds-to-local.md
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
View OpenAI-Code-Gen-and-Execution
A Python script that utilizes the OpenAI API to generate Python code based on user prompts, execute the generated code, check for errors, and suggest new features while ensuring their correctness.
@Changaco
Changaco / btrfs-undelete
Last active November 3, 2023 15:56
btrfs-undelete
View btrfs-undelete
#!/bin/bash
# btrfs-undelete
# Copyright (C) 2013 Jörg Walter <info@syntax-k.de>
# This program is free software; you can redistribute it and/or modify it under
# the term of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
if [ ! -b "$1" -o -z "$2" -o -z "$3" ]; then
echo "Usage: $0 <dev> <file/dir> <dest>" 1>&2
echo
@rcarrata
rcarrata / regenerate-kubeconfig.sh
Last active October 27, 2023 19:27
Script for regenerating the kubeconfig for system:admin user
View regenerate-kubeconfig.sh
#!/bin/bash
AUTH_NAME="auth2kube"
NEW_KUBECONFIG="newkubeconfig"
echo "create a certificate request for system:admin user"
openssl req -new -newkey rsa:4096 -nodes -keyout $AUTH_NAME.key -out $AUTH_NAME.csr -subj "/CN=system:admin"
echo "create signing request resource definition"
@marcelloinfoweb
marcelloinfoweb / install-vscode.sh
Created July 24, 2020 13:26
Install vscode on Clear Linux
View install-vscode.sh
#!/bin/bash
# https://openwebcraft.com/notes/clearlinux-desktop-setup/
echo "--- start"
wget https://vscode-update.azurewebsites.net/latest/linux-x64/stable -O code_latest_amd64.tar.gz
SRC_FILE=code_latest_amd64.tar.gz
DEST=/opt/code
@cderv
cderv / 00-New setup.md
Last active July 5, 2023 22:14
New computer setup
View 00-New setup.md
# installed by winget
winget install PowerShell-Preview
winget install git
git config --global user.name "Christophe Dervieux"
git config --global user.email christophe.dervieux@gmail.com
winget install rstudio
winget install vscode
winget install -e R
winget install Github.GithubDesktop
@cmbaughman
cmbaughman / firefox-dev-linux.md
Created October 12, 2020 14:14
Install Firefox Developer Edition On Linux
View firefox-dev-linux.md

Installing the latest Firefox Developer Edition on Linux

Prerequisites

You need to have the application curl installed. Most Linux distros will already have it included. However, you may need to run either:

Fedora/RedHat

$ sudo dnf -y install curl
@krishchow
krishchow / controllerconfig.yaml
Last active December 15, 2022 18:17
Openshift Crossplane SecurityContext
View controllerconfig.yaml
apiVersion: pkg.crossplane.io/v1alpha1
kind: ControllerConfig
metadata:
name: openshift-config
namespace: crossplane-system
spec:
securityContext: {}
podSecurityContext: {}
---
apiVersion: pkg.crossplane.io/v1