This commit is contained in:
sadan 2024-11-26 17:01:58 -05:00
parent 59ee516926
commit 5a3af882ec
No known key found for this signature in database
61 changed files with 705 additions and 562 deletions

View file

@ -0,0 +1,8 @@
command -v xsel > /dev/null
if [[ $? -eq 0 ]]; then
xsel -ib $@ && exit 0
fi
command -v wslclip > /dev/null
if [[ $? -eq 0 ]]; then
wslclip $@ && exit 0
fi

View file

@ -0,0 +1,62 @@
{pkgs, lib, inputs, ...}:
let
cpkg = import ../../../customPackages { inherit pkgs inputs; };
# https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
mkScript = { name, version ? "0.0.1", file, env ? [ ] }:
pkgs.writeTextFile {
name = "${name}-${version}";
executable = true;
destination = "/bin/${name}";
text = ''
for i in ${lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
exec ${bash}/bin/bash ${file} $@
'';
};
in
{
home = {
packages = with pkgs; [
# env for clipboard command will be required by their respective environemnts
(mkScript {
name = "paste";
file = ./paste.sh;
})
(mkScript {
name = "copy";
file = ./copy.sh;
})
(mkScript {
name = "http2ssh";
file = ./http2ssh.sh;
env = [git];
})
(mkScript {
name = "git_fetchAll";
file = ./git_fetchAll.sh;
env = [git];
})
(mkScript {
name = "install_eslint";
file = ./install_eslint.sh;
})
(mkScript {
name = "math";
file = ./math.sh;
env = [python3];
})
(mkScript {
name = "hashi18n";
file = ./hashi18n.sh;
})
];
file = {
scripts = {
source = "${cpkg.scripts}";
target = ".scripts";
};
};
};
}

View file

@ -0,0 +1,3 @@
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all

View file

@ -0,0 +1 @@
xsel -ob | node $HOME/.scripts/hash.js | tr -d '\n' | xsel -ib

View file

@ -0,0 +1,12 @@
set -eo pipefail
if [[ -z $1 ]]; then
echo "You need to provide a remote name";
echo "Avilable remotes";
git remote -v;
exit 1;
fi
URL=$(git remote get-url $1);
URL=${URL/https:\/\//git@};
URL=${URL/\//:};
git remote set-url $1 $URL;

View file

@ -0,0 +1,10 @@
set -x
cp $HOME/.config/.eslintrc.json .
pkgs=("@stylistic/eslint-plugin" "@typescript-eslint/eslint-plugin")
if [[ -z $1 ]]; then
echo please specify npm, pnpm, or yarn
exit 1
fi
for i in "${pkgs[@]}"; do
`$1 i -D $i`
done

View file

@ -0,0 +1,2 @@
set -e
python3 -c "print($*)"

View file

@ -0,0 +1,8 @@
command -v xsel > /dev/null
if [[ $? -eq 0 ]]; then
xsel -ob && exit 0
fi
command -v wslclip > /dev/null
if [[ $? -eq 0 ]]; then
wslclip -g && exit 0
fi