Skip to content

Instantly share code, notes, and snippets.

View juzten's full-sized avatar
💭
(┛ಠ_ಠ)┛彡┻━┻

Justin Spain juzten

💭
(┛ಠ_ಠ)┛彡┻━┻
View GitHub Profile
@juzten
juzten / multiplecheckbox.py
Created April 11, 2015 07:48 — forked from doobeh/example.html
custom multiple checkbox field for wtforms and flask
from flask import Flask, render_template
from flask.ext.wtf import Form, widgets, SelectMultipleField
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
@juzten
juzten / example.html
Created September 28, 2015 04:08 — forked from doobeh/example.html
Simple example of using a RadioField in Flask-WTForms to generate a form.
<form method="post">
{{ form.hidden_tag() }}
{{ form.example }}
<input type="submit">
</form>
@juzten
juzten / how-to-copy-ssh-keys-to-another-machine.md
Created December 20, 2016 06:16 — forked from nepsilon/how-to-copy-ssh-keys-to-another-machine.md
How to copy SSH keys to another machine? — First published in fullweb.io issue #79

How to copy SSH keys to another machine?

Public key authentication is generally safer than password-based and is way more convenient.

SSH offers a command to set it up, ssh-copy-id (part of the openssh client package) will copy your public key to the remote machine. Use it like this:

ssh-copy-id -i ~/.ssh/my_key.pub remote-machine
@juzten
juzten / how-to-update-a-github-forked-repository.md
Created May 9, 2017 03:32 — forked from nepsilon/how-to-update-a-github-forked-repository.md
How to update a GitHub forked repository? — First published in fullweb.io issue #91

How to update a GitHub forked repository?

So you hit "Fork" and now you have this repo copy on your Github account. Here is what to do to keep it up-to-date with the original repo.

1. Add the original repo as remote, here called upstream:

git remote add upstream https://github.com/author/repo.git

2. Fetch all the branches of that upstream remote:

@juzten
juzten / postgres-import-export-csv.md
Created December 6, 2017 05:16 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.

@juzten
juzten / excel_things.py
Created December 7, 2017 20:23 — forked from urschrei/excel_things.py
Open CSV or Excel files, return the contents as a list of lists, write out to Excel file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
excel_things.py
Created by Stephan Hügel on 2011-05-07
Read XLS or CSV files, and return contents as unicode strings in nested lists
One row per list item, one column per nested list item:
[[u'foo', u'bar'], [u'baz', u'abc123'], … ]
@juzten
juzten / code style.md
Created May 23, 2018 12:49 — forked from igogrek/Vue code style.md
Code style and application structure

Application structure

General

  1. Application has tree structure with folders for each "feature"
  2. Feature folders are named with lowerCamelCase → myComponentDashboard
  3. Feature can contain any number of components and nested features
  4. Components are named using UpperCamelCase → MyWidgetComponent.vue
  5. Component can have translation .yml file named correspondingly → MyWidgetComponent.yml
  6. If component requires more than 2 files: .vue and .yml file - folder is created with the same name → MyWidgetComponent

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@juzten
juzten / gist:2ccc68cf185722d131500bd50ac7582d
Created October 10, 2018 23:33 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@juzten
juzten / gist:6505c251ea7fdd417d638adad9f43d88
Created April 10, 2020 01:16 — forked from ozh/git cherry-pick within a pull request.md
git cherry-pick within a pull request

1. Create new branch:

git checkout -b otherrepo-master master

2. Get the contents of the PR

git pull https://github.com/otherrepo/my-repo-name.git master