Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hashlash's full-sized avatar

hashlash

View GitHub Profile
@hashlash
hashlash / schema.yaml
Created March 11, 2022 03:33
DRF bug SafeString help_text
openapi: 3.0.2
info:
title: Your Project
version: 1.0.0
description: "API for all things \u2026"
paths:
/example-model/:
get:
operationId: listExampleModels
description: Concrete view for listing a queryset or creating a model instance.
@hashlash
hashlash / Caddyfile
Last active June 15, 2021 03:11 — forked from ryanburnette/Caddyfile
Caddy v2.1 CORS whitelist
(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
}
(cors_regexp) {
@origin_regexp{args.0} header_regexp Origin {args.0}
header @origin_regexp{args.0} Access-Control-Allow-Origin "{header.Origin}"
}
@hashlash
hashlash / docker-management.md
Created November 2, 2020 06:44
Docker Management

Volume

  • Get all volumes directory and its size
docker volume ls --format {{.Name}} | xargs docker inspect --format {{.Mountpoint}} | sudo xargs du -sh
@hashlash
hashlash / graphql.py
Last active March 20, 2021 06:57
pkg.go.dev repo imported by sorted by stats
import json
import re
import requests
import uuid
# No OAuth scope required
# Just create a personal access token on https://github.com/settings/tokens/new
API_KEY = 'api key example'
QUERY_FORMAT = '''
@hashlash
hashlash / README.md
Last active October 17, 2021 15:21
Setup Kubernetes Using Kubeadm Cheatsheet (It Just Work!)
$ ./manage.py makemigrations
No changes detected
$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, my_app, sessions
Running migrations:
No migrations to apply.
$ ./manage.py migrate --fake my_app zero
Operations to perform:
Unapply all migrations: my_app
@hashlash
hashlash / network.md
Last active June 25, 2020 14:36
Network Inspection Cheatsheet

ip

ip a
ip link show
ip r

lspci

@hashlash
hashlash / README.md
Last active December 18, 2020 18:37
Binary Exploitation Cheatsheet
@hashlash
hashlash / README.md
Created June 7, 2020 16:44
Logic Programming

Logic Programming

The Problem of Normal Logic Program

It use negation (unlike definite logic program) which make the logical entailment not hold.

  • Program Completion (Clark, 1978): change rule's implication to bi-implication

  • Stable Model Semantic (Gelfond and Lifschitz, 1988): remove negative literals (either the whole rule, or just the literal in the body)