Skip to content

Instantly share code, notes, and snippets.

View ragnarok22's full-sized avatar
🏠
Working from home

Reinier Hernández ragnarok22

🏠
Working from home
View GitHub Profile
@stefanfoulis
stefanfoulis / auth_views.py
Created August 11, 2011 16:44
django: class based authentication view (login)
#-*- coding: utf-8 -*-
import urlparse
from django.contrib.auth import REDIRECT_FIELD_NAME, login
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.generic.edit import FormView
from django.conf import settings
@danielestevez
danielestevez / gist:2044589
Last active October 7, 2024 15:24
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@gka
gka / sqlite3-example.py
Last active June 4, 2023 01:32
The code below does the same as the example snippet you've just seen: opening a database connection, creating a new table with some columns, storing some data, altering the table schema and adding another row.
import sqlite3
# open connection and get a cursor
conn = sqlite3.connect(':memory:')
c = conn.cursor()
# create schema for a new table
c.execute('CREATE TABLE IF NOT EXISTS sometable (name, age INTEGER)')
conn.commit()
@noahmorrison
noahmorrison / battery
Last active July 8, 2022 19:30
Bar for bspwm
#!/bin/sh
sc () {
if [ $COLOR = "bar" ] ; then
case $2 in
bold) case $1 in
black) echo "%{F#FF000000}";;
red) echo "%{F#FFFF0000}";;
green) echo "%{F#FF00FF00}";;
yellow) echo "%{F#FFFF4500}";;
@briandk
briandk / CONTRIBUTING.md
Created March 18, 2016 20:29
A basic template for contributing guidelines that I adapted from Facebook's open source guidelines

Contributing to Transcriptase

We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

We Develop with Github

@matthewjberger
matthewjberger / instructions.md
Last active November 7, 2024 17:51
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@badri
badri / cbv_multiple_forms.html
Created January 18, 2018 04:03
Django multiple forms code with sample usage
{% extends "base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
{{ forms.subscription }}
<input type="submit" value="Subscribe">
</form>
<form method="post">{% csrf_token %}
{{ forms.contact }}
<input type="submit" value="Send">
@vijinho
vijinho / markdown_escape.php
Last active September 22, 2024 22:37
Escape markdown in php
<?php
/**
* Escape markdown text
*
* @param string $text the markdown text to escape
*
* @return string escaped text
*/
function markdown_escape($text) {
return str_replace([
@ilyvsc
ilyvsc / zshrc.sh
Last active August 10, 2024 14:52
Preview content inside files using `fzf`
# fzf improvement to preview content from files
function fzf-lovely(){
fzf -m --preview '[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'
}