Skip to content

Instantly share code, notes, and snippets.

@belkarx
belkarx / discordinstall.sh
Created July 26, 2021 22:51
Install Discord on Linux
#!/bin/bash
#this should technically work in zsh and other popular shells
#run with sudo, in the folder you want the source to be extracted in (example: cd ~/Downloads && ./../discordinstall.sh)
#make sure to chmod +x before attempting to run
DATE=$(date +"%m-%d-%Y")
wget "discord.com/api/download?platform=linux&format=tar.gz" --output-document="discord-$DATE.tar.gz"
sudo tar -xvzf "discord-$DATE.tar.gz" -C /opt
sudo ln -sf /opt/Discord/Discord /usr/bin/Discord
echo "[Desktop Entry]
Name=Discord
@belkarx
belkarx / installing_geckodriver.txt
Created November 16, 2021 04:57
Installing geckodriver
Firefox:
1) Go to https://github.com/mozilla/geckodriver/releases
If you scroll down to the bottom of the page, you will see a list titled 'Assets' that resembles this:
Assets (9)
geckodriver-v0.29.0-linux32.tar.gz 2.71 MB
geckodriver-v0.29.0-linux32.tar.gz.asc 833 Bytes
geckodriver-v0.29.0-linux64.tar.gz 2.53 MB
geckodriver-v0.29.0-linux64.tar.gz.asc 833 Bytes
geckodriver-v0.29.0-macos.tar.gz 1.79 MB
geckodriver-v0.29.0-win32.zip 1.37 MB
@belkarx
belkarx / chromedriver_install.txt
Created November 16, 2021 04:59
Installing chomedriver
Chrome:
1) Check your Chrome version through [3 dots in corner] -> Help -> About Google Chrome
A page should come up with this information (The version number may be different but it will be in that format):
Version 88.0.4324.150 (Official Build) (64-bit)
2) Go to https://chromedriver.chromium.org/downloads
At the very top, there will be a list titled 'Current releases'
Underneath you will see a few lines following this format:
If you are using Chrome version X, please download ChromeDriver XX.X.XXX.XX
@belkarx
belkarx / Add a local repository to github.txt
Created December 28, 2021 07:09
Add a local repository to github
# create github repo (named EXAMPLE) using github's web interface
cd EXAMPLE
git init
git add .
git commit -m "added files"
git remote add origin git@github.com:belkarx/EXAMPLE.git
git remote -v
git push --set-upstream origin main
git status
OMG imagine using *that* disgusting language over *RUST*. As a proud rustacean, I'm going to inform you: that's blasphemy. You can do better. Grab cargo and start using a beautiful memory managed, statically typed, comfortable yet low level language with a spectacular packaging system. No more memory leaks. No more makefiles. End the weird bugs caused by unrequested type casting. Easily find libraries. AND ALL OF THAT IS BLAZING FAST (at C/cpp-level speeds - yay compiled langs and llvm :)))). Why wouldn't you? The syntax is spectacular as well; extremely clean, much better than anything else out there. Those match statements are so extremely pleasant, and the looping conventions are orgasmic. And the compiler is the most useful and polite you'll come across; no more endlessly scrolling segmentation fault and template errors. It's amazing and I love it and you should switch now because it's far superior to literally everything else, all those gross languages you're used to using. Come to rust and you'll never
@belkarx
belkarx / gist:d8f6dcc2e7e52d96f3819e6a00e6a80a
Created February 15, 2022 04:39
How to copy Arch to a new disk
replace PARTUUIDs/UUIDs (of root and boot/esp) in /etc/fstab and [your bootloader config file] (for me it was /boot/refind.conf)
dd if=/dev/nvme0n1 of=/dev/sda
@belkarx
belkarx / todos_and_notetaking.sh
Last active April 10, 2022 02:34
Todos and notetaking
# Opens up a text document in the ~/notes/jour folder
# with the date as the name (in the *best* format, as 2022-01-01)
# and appends a timestamp (padded with newlines, I should add a conditional to not prepad if the file doesn't exist yet but it doesn't really bother me atm)
# then your cursor is directly below the timestamp and you can make an entry
#[jour means day in french]
alias jour='echo "\n$(date +%T)\n" >> $HOME/notes/jour/$(date +%Y-%m-%d) && nvim -c "+normal G$" $HOME/notes/jour/$(date +%Y-%m-%d)'
#makes a note in ~/notes from anywhere (spaces in filename are replaced by underscores)
not() {
nvim -c "startinsert" ~/notes/$(echo $@ | sed 's/\ /_/g')
@belkarx
belkarx / symb_diff.rs
Last active April 30, 2022 16:09
symb_diff.rs
use std::io::{stdin,stdout,Write};
use regex::Regex;
/* Polynomial: involves only the operations
* of addition, subtraction, multiplication,
* and non-negative integer exponentiation
* of variables
*/
fn main() {
//get user input
@belkarx
belkarx / clipurl.sh
Last active May 15, 2022 15:24
Puts all copied URLs in a file
while clipnotify
do
paste=$(parcellite -c)
if [[ -z $(echo $paste | grep -Eoq "(http|https)://[a-zA-Z0-9./?=_-]*") ]]
then
echo -e "$paste\n$(date +%Y-%m-%d/%H:%M)" >> $HOME/notes/clipurls
### Avoids duplicates
#prev=$(tail -n1 $HOME/notes/clipurls)
#if [[ "$paste" != "$prev" ]]; then
# echo -e "$paste\n$(date +%Y-%m-%d/%H:%M)" >> $HOME/notes/clipurls
@belkarx
belkarx / parse.sh
Created July 20, 2022 21:07
whatever_whatever2.txt -> whatever.txt
find . -type f -exec sh -c 'x="{}"; mv "$x" "$(echo $x | cut -d_ -f1)".txt' \;