Skip to content

Instantly share code, notes, and snippets.

View Kenan7's full-sized avatar

Mirkenan Kazimzade Kenan7

View GitHub Profile
@Kenan7
Kenan7 / index.html
Created August 12, 2026 13:34 — forked from smontlouis/index.html
please don't sue me
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="color-scheme" content="light dark" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22><circle cx=%2232%22 cy=%2232%22 r=%2230%22 fill=%22%235b7fe5%22/><circle cx=%2224%22 cy=%2228%22 r=%225%22/><circle cx=%2240%22 cy=%2228%22 r=%225%22/></svg>"
/>
@Kenan7
Kenan7 / admin.py
Created October 24, 2024 20:06
reverse m2m widget in django admin
from django import forms
from django.contrib import admin
from django.db import models
from django.contrib.admin import widgets
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import gettext as _
class CustomUserForm(forms.ModelForm):
company_structures = forms.ModelMultipleChoiceField(
queryset=CompanyStructure.objects.all(),
@Kenan7
Kenan7 / middleware.py
Last active October 5, 2024 17:04
middleware
import cProfile
import pstats
import io
import traceback
import time
import logging
from django.conf import settings
from django.db import connection, reset_queries
from django.utils.deprecation import MiddlewareMixin
��#}�(�metadata�}�(�title�� Test (Energy Performance Report)�� workspace��Test��source��DEADBEEF�� cur_start��datetime��datetime���C
� ���R��cur_end�h C
� ���R��
created_at�� mock.mock��_ANY���)��� ref_start�J3�gb�ref_end�h C
�
97���R�u�summary�}�� active_energy�}�(� consumption�}�(�v��numpy.core.multiarray��scalar����numpy��dtype����f8�����R�(K�<�NNNJ����J����Kt�bC33333�F@���R��units��kWh��percent_change��0 %�� trend_arrow��!TODO_trend_arrow_calculation_here��other��Price per kWh: 0.5 EUR�u�
total_cost�}�(h$h'h-C33333�6@���R�h3�EUR�h5h6h7h8h9�Price per kWh: 0.5 EUR�u� footprint�}�(h$h'h-CX9���-@���R�h3�
tones CO2e�h5h6h7h8h9�Conversion factor k = 0.33�uus� voltage_max�}�(�V1r�}�(h$h'h*�i8�����R�(Kh.NNNJ����J����Kt�bC����R��t�GAؙ�?�u�V2r�}�(h$h'hOC����R�hTGAؙ�?u�V3r�}�(h$h'hOC����R�hTGAؙ�?�u�unit��V�u� voltage_min�}�(hK}�(h$h'hOC����R�hTGAؙ�>�uhU}�(h$h'hOC����R�hTGAؙ�>�uhZ}�(h$h'hOC�
@Kenan7
Kenan7 / index.html
Created November 20, 2021 11:06
Modern Blog Layout with CSS Grid
<div class="blog">
<div class="blog-part is-menu">
<a href="#" class="blog-menu">
Work
<svg fill="none" stroke="currentColor" stroke-width=".7" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-up-right" viewBox="0 0 24 24">
<path d="M7 17L17 7M7 7h10v10" />
</svg>
</a>
<a href="#" class="blog-menu">Studio</a>
<a href="#" class="blog-menu">Blog</a>
@Kenan7
Kenan7 / .aliases
Last active October 25, 2021 12:14
Little tools and aliases
function find-and-kill() {
# find the process id given port number
# $1 is the port number
# get the process id
pid=$(sudo lsof -i :$1 -t)
echo "Killing process id -> $pid"
sudo kill -9 $pid
echo "Done ✔️"
}
@Kenan7
Kenan7 / cbar.py
Last active April 26, 2022 20:16
Get currency from CBAR
import xml.etree.ElementTree as ET
from datetime import date
import requests
from logzero import logger
'''
value = CurrencyCbar().get_one_try()
'''
@Kenan7
Kenan7 / client.py
Last active June 24, 2020 15:55
XML-RPC Python server-client example
import xmlrpc.client
with xmlrpc.client.ServerProxy("http://localhost:5080/") as proxy:
print("sum of 1 and 1 is: %s" % str(proxy.add(1, 1)))
print("subtraction of 2 from 5 is: %s" % str(proxy.sub(5, 2)))