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
@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'
}
@Koratsuki
Koratsuki / Ubuntu-24.04-fresh-install.md
Last active July 9, 2025 17:35
Ubuntu 24.04 fresh install

Ubuntu 24.04 fresh install guide

First of all, I must say that I'am not a fan or user of Ubuntu. This is just a guide for newcomers, and colleagues that are struggling after the new release with the system changes.

Repositories configurations and system upgrade

Right after fresh install, you must do a system update. Don't delay it, but first, let's configure repositories. Delete the new config for repositories, this can cause problems or new users can get lost configuring it, have friends reporting me that:

@vijinho
vijinho / markdown_escape.php
Last active February 13, 2025 16:12
Return a given string with the text markdown escaped, in PHP
<?php
/**
* Escape markdown text
*
* @param string $text The markdown text to escape
*
* @return string Escaped text
*/
function markdown_escape($text) {
// Define a regex pattern for all special characters in markdown
@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">
@matthewjberger
matthewjberger / instructions.md
Last active September 17, 2025 15:33
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

@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

@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}";;
@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()
@danielestevez
danielestevez / gist:2044589
Last active August 19, 2025 02:29
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}
@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