Skip to content

Instantly share code, notes, and snippets.

View funnydman's full-sized avatar
😀
working

funnydman

😀
working
View GitHub Profile
@funnydman
funnydman / combined_expressions.py
Created December 1, 2020 12:56
combined expressions Django helper
# https://stackoverflow.com/questions/58877390/how-to-collect-results-into-array-from-annotation
"""
Some different ways:
"""
class CombinedExpressions(SQLiteNumericMixin, Expression):
def __init__(self, *expressions, connector, output_field=None):
@funnydman
funnydman / celerey-headless.pipeline
Last active November 25, 2020 09:07
Celery headless configuration for pipeline
sudo: required
language: python
python:
- "3.6"
# command to install dependencies
install:
- pip install -r requirements.txt
# command to run tests
script:
- python manage.py behave
@funnydman
funnydman / vim_cheatsheet.md
Created November 4, 2020 17:23 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@funnydman
funnydman / tokens.md
Created May 27, 2020 17:15 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 20.04.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов

Vim Script for Python Developers

A guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with programming in Python.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way


Variables

@funnydman
funnydman / gist:f664b8da7a21bfdc92bf7832407da8bd
Created January 2, 2020 09:20
differences in order_by behaviour
# settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'helloworld',
'PASSWORD': 'adminhris',
'USER': 'adminhris',
'HOST': 'localhost'
},
import timeit
setup = '''
import random
random.seed('slartibartfast')
s = [random.random() for i in range(1000)]
timsort = list.sort
'''

radare2

load without any analysis (file header at offset 0x0): r2 -n /path/to/file

  • analyze all: aa
  • show sections: iS
  • list functions: afl
  • list imports: ii
  • list entrypoints: ie
  • seek to function: s sym.main
@funnydman
funnydman / boot.asm
Created September 24, 2018 12:31 — forked from lpsantil/boot.asm
; src/boot/boot.asm
; Bootloader to load kernel, switch to 32-bit protected mode and execute kernel
[BITS 16] ; 16-bit real mode
[ORG 0x7C00] ; Loaded into memory at 0x7C00
MOV [bootDrive], DL ; Store DL (boot drive number) in memory
MOV BP, 0x9000 ; Move Base Pointer in free memory space
MOV SP, BP ; Move Stack Pointer to base of stack
@funnydman
funnydman / hello-boot.asm
Created September 24, 2018 11:05 — forked from yackx/hello-boot.asm
Hello World bootloader in assembly language
;----------------------------------------------;
;
; A minimal bootloader that prints a hello world
; then halts.
;
; nasm -f bin hello-boot.asm -o hello-boot.bin
;
; @YouriAckx
;
;----------------------------------------------;