Skip to content

Instantly share code, notes, and snippets.

View t-book's full-sized avatar
💭
reading

Toni t-book

💭
reading
View GitHub Profile
@t-book
t-book / workbook.md
Created July 26, 2023 15:19 — forked from leisurelicht/workbook.md
Export queryset to Excel workbook
from django.http import HttpResponse
from .utils import queryset_to_workbook

def download_workbook(request):
    queryset = User.objects.all()
    columns = (
        'first_name',
        'last_name',
        'email',
@t-book
t-book / mselect-to-mcheckbox.css
Created March 24, 2021 13:40 — forked from abidibo/mselect-to-mcheckbox.css
Library to substitute the multiple select widget with a multiple checkbox in django admin
.mcheckbox-container {
display: inline-block;
vertical-align: middle;
height: 160px;
overflow: auto;
}
.mcheckbox-table {
margin-right: 20px;
width: 100%;
}
@t-book
t-book / git_rebase.md
Created March 16, 2021 08:05 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@t-book
t-book / openrefine.md
Created March 3, 2021 07:38 — forked from netsensei/openrefine.md
Open Refine tips & tricks
#!/usr/bin/ruby
require 'socket'
hostname = ARGV[0]
port = ARGV[1]
filename = ARGV[2]
begin
socket = TCPSocket.new( hostname, port )
socket.send( "zINSTREAM\0", 0)
@t-book
t-book / create_ftp_user.sh
Created January 19, 2021 07:36 — forked from bbrothers/create_ftp_user.sh
Bash for creating vsftp users
#!/bin/bash
# Create ftp user, create folders and set permissions
# Shamelessly coppied from http://dev.n0ise.net/2012/09/vsftpd-add-user-automation-bash-script/
# Usage: ./create_ftp_user.sh [username] "[password]"
#
NAME=$1
PASS=$2
@t-book
t-book / docker_apparmor.conf
Last active January 6, 2021 12:55 — forked from disconnect3d/docker_apparmor.conf
docker-default
#include <tunables/global>
profile docker-default flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
network,
capability,
@t-book
t-book / backupRestoreGeonode.sh
Created May 16, 2018 10:52 — forked from jailbirt/backupRestoreGeonode.sh
backup and restore geonode
#!/bin/bash
option=$1
geonodeBackup='/home/geonode_backups'
mkdir $geonodeBackup
date=$(date +%Y-%m-%d-%H)
function stopServices
{
echo "Stopping services"
sudo service apache2 stop