Skip to content

Instantly share code, notes, and snippets.

View renegarcia's full-sized avatar

Rene Garcia renegarcia

View GitHub Profile
@renegarcia
renegarcia / update-wallpaper.fish
Last active August 31, 2023 20:49
Kde Update Wallpaper
#!/usr/bin/env fish
#Update your wallpaper image from Bing's daily image in KDE.
#Requirements
# Fish shell
# kwallpaper.py available here:
# https://gist.github.com/renegarcia/3890018ebab038f1f2e8adc8e3903231
# wpx (https://pypi.org/project/wpx/)
set fname (wpx -d {$HOME}/Pictures/wallpapers --set-desktop --daily bing)
kwallpaper.py $fname
@renegarcia
renegarcia / kwallpaper.py
Last active July 8, 2023 18:36
Setup wallpaper image in plasma shell (Cli)
from subprocess import call
from argparse import ArgumentParser
JS = """
/*
* This script is meant to be run from the python interface below.
*/
const allDesktops = desktops();
for (desktop of allDesktops){{
desktop.wallpaperPlugin = "org.kde.image";
@renegarcia
renegarcia / url-to-title.py
Created June 2, 2023 19:18
This program reads an url and prints the last part of the path as a title. Suitable for creating hyperlinks in markdown
"""
# URL to title
Simple program that reads an url and prints the last part of the path as a title.
## Case of use
I use this to format references in my mardown documents. For example, given the url
```
@renegarcia
renegarcia / dendron.desktop
Last active May 29, 2023 22:08
Dendron desktop file. Install into ~/.local/share/applications or system wide.
[Desktop Entry]
Comment=A personal knowledge management tool that grows as you do.
Comment[es]=Una herramienta de administración de conocmiento personal que crece contigo.
Exec=code --no-sandbox --new-window Dendron/dendron.code-workspace
Name=Dendron
Type=Application
StartupWMClass=code
Keywords=dendron;notes;pkm;
Categories=Utility;TextEditor;
@renegarcia
renegarcia / passgen.py
Last active May 29, 2023 19:30
passgen.py
from secrets import choice
import string
import argparse
ALPHABET = string.ascii_letters + string.digits + string.punctuation
def password_generator(len:int =10, alphabet: list[str] = ALPHABET) -> str:
return "".join(choice(alphabet) for i in range(len))
@renegarcia
renegarcia / update-site.sh
Last active August 31, 2023 20:48
Update python anywhere site to the latest commit tagged.
#!/bin/bash
$TARGET="the absolute path to the directory hosting your project"
cd $TARGET
git fetch --all --tags
latestTag=`git describe --tags $(git rev-list --tags --max-count=1)`
git checkout tags/$latestTag -b $latestTag
@renegarcia
renegarcia / pythonanywhere-db-backup.sh
Last active August 31, 2023 20:50
Database backup for python anywhere
#!/bin/bash
USERNAME="writeyourusernmehere"
HOST="$USERNAME.mysql.pythonanywhere-services.com"
TABLENAME='your table name'
NOW=`date --iso-8601=seconds`
DBDIR=$HOME/db-backup
BACKUP_FILE="$DBDIR"/db-backup-"$NOW".sql.gz
mysqldump -u $USERNAME -h $HOST --set-gtid-purged=OFF --no-tablespaces --column-statistics=0 "$TABLENAME" | gzip > "$BACKUP_FILE"
@renegarcia
renegarcia / calendar.glade
Created July 24, 2022 18:43
Simple date counter
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
@renegarcia
renegarcia / make_webworks_csv.py
Created February 11, 2022 15:29
This scripts takes a moodle students csv file and returns a webworks (csv) classlist file. Te program WONT ask to overwrite any of the files, be careful.
# USSAGE
# python make_webworks_csv.py <input.csv> <output.lst>
from collections import namedtuple
import csv
import codecs
Student = namedtuple('Student', 'Name Surname Email')
WebworkStudent = namedtuple('WebworkStudent',
'student_id first_name last_name status comment section recitation email_address user_id')
@renegarcia
renegarcia / latex-emacs.gitignore
Last active March 15, 2019 13:19
latex-emacs.gitignore
# -*- mode: gitignore; -*-
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc