Skip to content

Instantly share code, notes, and snippets.

Avatar
🖥️
in a meeting

Uğur Özyılmazel vigo

🖥️
in a meeting
View GitHub Profile
View django-bash-completion.bash
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
@vigo
vigo / liste.bash
Created Sep 4, 2022
Pretty $PATH printer!
View liste.bash
#!/usr/bin/env bash
#
# Created by Uğur "vigo" Özyılmazel on 2017-04-26.
# Copyright (c) 2017 VB YAZILIM. All rights reserved.
set -e
set -o pipefail
usage() {
cat <<EOF
View keybase.md

Keybase proof

I hereby claim:

  • I am vigo on github.
  • I am vigo (https://keybase.io/vigo) on keybase.
  • I have a public key whose fingerprint is 19CA CF8F 3AB4 06F6 D644 5842 D097 2B1B BE84 BBE4

To claim this, I am signing this object:

@vigo
vigo / perf-diagnostics.css
Created Jan 23, 2021 — forked from tkadlec/perf-diagnostics.css
CSS used to highlight potential performance issues
View perf-diagnostics.css
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
@vigo
vigo / postgres-cheatsheet.md
Created Oct 13, 2020 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@vigo
vigo / Rakefile
Last active Nov 25, 2022
Rake task örneği
View Rakefile
task :default => [:menemen_yap]
task :menemen_yap => [:tereyag_al, :yumurta_al, :domates_al, :sivri_biber_al, :sahani_isit, :sebzeleri_pisir, :yumartayi_kir] do
puts "Menemen yapıyıyoruz"
end
task :tereyag_al => [:bakkala_git] do
puts "Tereyağı alıyoruz"
end
@vigo
vigo / admin.py
Created Mar 14, 2019 — forked from hakib/admin.py
How to Turn Django Admin Into a Lightweight Dashboard
View admin.py
# https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard
from django.contrib import admin
from django.db.models import Count, Sum, Min, Max, DateTimeField)
from django.db.models.functions import Trunc
from . import models
def get_next_in_date_hierarchy(request, date_hierarchy):
View workflows-in-django.md

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@vigo
vigo / json_server.py
Last active Jan 26, 2022
Basic JSON webserver
View json_server.py
#!/usr/bin/env python
import sys
import time
import argparse
import os
import json
import socketserver
from http.server import BaseHTTPRequestHandler