Skip to content

Instantly share code, notes, and snippets.

View renegarcia's full-sized avatar

Rene Garcia renegarcia

View GitHub Profile
@renegarcia
renegarcia / test.py
Last active August 29, 2015 14:19 — forked from href/test.py
import inspect
import morepath
import os
from webob import static
class App(morepath.App):
@property
@renegarcia
renegarcia / test_ode_solver_sympy.py
Created February 5, 2018 17:49
How to test the solution to an ordinary differential equation found with sympy.
'''
How to test a ODE in sympy properly.
See [http://docs.sympy.org/latest/modules/solvers/ode.html#checkodesol] for more
'''
import sympy as sp
x, h = sp.symbols('x h')
eq = sp.diff(h(x), x) - h(x)
sols = sp.dsolve(eq)
sol = sols.rhs
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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
```