Skip to content

Instantly share code, notes, and snippets.

View albe-rosado's full-sized avatar

Alberto Rosado albe-rosado

  • AWS
  • Seattle, WA
View GitHub Profile
@app.route('/', methods=['GET', 'POST'])
def index():
form = ContactForm()
if form.validate_on_submit():
# ... do whatever you need
form.reset()
# ...
return render_template('index.html', form=form)
from werkzeug.datastructures import MultiDict
from flaskext.wtf import FlaskForm, StringField, #....
class ContactForm(FlaskForm):
email = StringField('Email', [DataRequired(), Email()])
# ...
submit = SubmitField('Submit')
def reset(self):
<div class="..." style="display: {{ visible }};">
<p>
<!-- ... -->
</p>
</div>
@app.route('/path', methods=['GET', 'POST'])
def page():
visible = 'none'
# to make the section hide or
visible = 'true'
# to be displayed
# then you can choose wheter or not show it, just changing the value of "visible"
return render_template('template.html', visible=visible)

Bash command line Shortcuts

Picked these from here

Command Editing Shortcuts

Command Note
Ctrl + a go to the start of the command line
Ctrl + e go to the end of the command line
Ctrl + k delete from cursor to the end of the command line

Keybase proof

I hereby claim:

  • I am albe-rosado on github.
  • I am albert_rosado (https://keybase.io/albert_rosado) on keybase.
  • I have a public key ASCYqGRVK8J_5medeabQLAoQ0hfa-pEynbFUMzjEv4GOiAo

To claim this, I am signing this object:

@albe-rosado
albe-rosado / ubuntu-nm-wiregard.sh
Created May 8, 2021 22:42
Command to install Ubuntu Wireguard network manager plugin
# instal dependencies
sudo apt install wireguard git dh-autoreconf libglib2.0-dev intltool build-essential libgtk-3-dev libnma-dev libsecret-1-dev network-manager-dev resolvconf
# clone repo and build
git clone https://github.com/max-moser/network-manager-wireguard
cd network-manager-wireguard
./autogen.sh --without-libnm-glib
./configure --without-libnm-glib --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/NetworkManager --localstatedir=/var

Mastodon Docker Setup

Setting up

Clone Mastodon's repository.

# Clone mastodon to ~/live directory
git clone https://github.com/tootsuite/mastodon.git live
# Change directory to ~/live

cd ~/live

@albe-rosado
albe-rosado / mt.rs
Last active October 11, 2023 03:05
use futures::StreamExt;
use std::{
thread::{self},
time::Duration,
};
async fn do_work(idx: u32) {
thread::sleep(Duration::from_millis(500));
dbg!(idx);
}