Skip to content

Instantly share code, notes, and snippets.

@mick88
mick88 / lazy_view.py
Last active February 27, 2025 20:11
Django: Lazy view
from typing import Callable
from django.utils.module_loading import import_string
from django.views import View
class LazyView:
"""
Wrapper for view class that can be used for urls to avoid loading the view class at the import time.
The view is imported at first access and cached.
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"comment.line",
"constant",
"constant.character",

User authentication system

Your task is now to create a user authentication system.

This document will guide you through all the features and implication of such system, so that you don't have to search them yourself.

We will focus on web/browser-technologies, however similar concept can be widely applied. This guide, is a work in progress, feel free to comment and provide feedbacks.

Expected Workflows

@paulolorenzobasilio
paulolorenzobasilio / git-is-merged
Last active May 23, 2024 16:57
Check if source branch has been already merged into destination branch
#!/usr/bin/env bash
#
# Check if source branch has been already merged into destination branch
# https://stackoverflow.com/questions/226976/how-can-i-know-if-a-branch-has-been-already-merged-into-master
#
git_is_merged () {
merge_destination_branch=$1
merge_source_branch=$2
@scotticles
scotticles / timer.sh
Last active May 3, 2020 16:58
A simple linux cli timer that alerts with sound and notification. ./timer.sh -m <minutes or -s <seconds> or by default if nothing is passed it will do 30 minutes.
#!/bin/bash
# ./timer.sh -h 1
# ./timer.sh -m 30
# ./timer.sh -s 10 for 10 seconds
# ./timer.sh -e 1h10m30s
# ./timer.sh -m <message>
seconds=1800;
message="Times Up!!!!"
#checks for -s or -m else defaults to 30 minutes
@flowstate
flowstate / MessageStore.js
Created September 14, 2018 01:29
MST / FireStore syncing approach
import { Person } from "./PersonStore";
const Message = t.model("MessageModel", {
id: t.identifier,
author: t.late(() => t.reference(Person)),
body: t.string,
title: t.string,
toPeople: t.array(t.late(() => t.reference(Person))),
read: false
})
@gricard
gricard / webpack4upgrade.md
Last active April 20, 2025 23:06
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ [email protected]
@worawit
worawit / eternalblue8_exploit.py
Last active March 16, 2024 18:38
Eternalblue exploit for Windows 8/2012
#!/usr/bin/python
# This file has no update anymore. Please see https://github.com/worawit/MS17-010
from impacket import smb, ntlm
from struct import pack
import sys
import socket
'''
EternalBlue exploit for Windows 8 and 2012 by sleepya
The exploit might FAIL and CRASH a target system (depended on what is overwritten)
@bonsi
bonsi / Makefile
Created November 26, 2016 11:28
Makefile - more enjoyable (shorter) docker management commands
# work in progress. inspired by serverforhackers example.
.PHONY: up down log tinker artisan test
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PWD := $(dir $(MAKEPATH))
up:
docker-compose -f laradock/docker-compose.yml up -d
image: my/nodejs-dockerfile
stages:
- test
- build
- deploy
before_script:
- ln -s /node_modules node_modules
- npm set progress=false