Skip to content

Instantly share code, notes, and snippets.

@Shrestha7
Shrestha7 / main.py
Created April 9, 2023 15:33
To add a .env file outside the .exe file when using PyInstaller, you can use the --add-data option to include the .env file in the distribution. Assuming that your .env file is located in the root directory of your project, and you want to include it in the same directory as the PyInstaller-generated .exe file, you can use the following command:
pyinstaller --add-data=".env;." myscript.py
# This command tells PyInstaller to include the .env file in the distribution, and to place it in the same directory as the .exe file.
# Note that the --add-data option takes two arguments separated by a semicolon: the first argument is the path to the .env file, and the second argument is the destination directory for the file. In this case, the destination directory is the current directory, denoted by the . symbol.
# After running this command, PyInstaller will generate a new directory containing the .exe file and the .env file, as well as any other necessary files for your script to run.
@wilmarvh
wilmarvh / git checkout-all-branches.sh
Created April 22, 2019 20:11
git checkout-all-branches
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
@kehh
kehh / warsync.sh
Created October 31, 2012 08:03
Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
#!/bin/bash
#Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
echo "Usage: $0 source.war destinationserver"
CURRENTDIR=$PWD
WARFILE="$CURRENTDIR/$1"
REMOTEHOST=$2
CURRENTUSER=$USER
REMOTEHOME="/home/$CURRENTUSER"
WARFILENAME=`basename $1`
echo "source is $WARFILE target is $TARGET"