Skip to content

Instantly share code, notes, and snippets.

@imankulov
imankulov / sqlalchemy_with_pydantic.py
Last active December 28, 2024 17:06
Using pydantic models as SQLAlchemy JSON fields (convert beween JSON and pydantic.BaseModel subclasses)
#!/usr/bin/env ipython -i
import datetime
import json
from typing import Optional
import sqlalchemy as sa
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.dialects.postgresql import JSONB
from pydantic import BaseModel, Field, parse_obj_as
@sharbel93
sharbel93 / How to solve this problem of "! [rejected] master -> master (fetch first)"
Created January 19, 2019 10:09
How to solve this problem of "! [rejected] master -> master (fetch first)"
First Do this ...
git fetch origin master
git merge master
Then, do this ...
git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
@thewh1teagle
thewh1teagle / main.py
Created October 23, 2024 18:44
Decrypt chrome v20 cookies with appbound protection
"""
Decrypt chrome v20 cookies with app bound protection
Tested in 2024-10-23 with Chrome version 130.0.6723.70 on Windows 11 23H2
pip install pywin32 pycryptodome pypsexec
python main.py
"""
import os
import json
import sys
@piyushgarg-dev
piyushgarg-dev / README.md
Last active December 28, 2024 17:00
Kafka Crash Course
@1Marc
1Marc / reactive.js
Last active December 28, 2024 16:56
Vanilla Reactive System
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/
let context = [];
export function untrack(fn) {
const prevContext = context;
context = [];
const res = fn();
context = prevContext;
return res;
@kashifulhaque
kashifulhaque / NvChad.md
Last active December 28, 2024 16:56
Neovim stuff with NvChad

Neovim keybinds

  • Capital letters do the opposite of small letters in command (Press shift to trigger capital letters)
  • _ (underscore) to move the cursor at the beginning of line (doesn't switch to insert mode)
    • 0 (zero) moves the cursor to the zeroth position of the line (doesn't switch to insert mode)
  • $ (dollar) to move the cursor at the end of line (doesn't switch to insert mode)
  • d$ will delete from wherever your cursor is till the end of the line
  • f<character> to move cursor to the first occurrence of <character>
    • f( to move cursor to first occurence of (
  • t<character> to move cursor to upto but not on the first occurrence of <character>
  • t( to move cursor to first occurence of (
@daif
daif / erpnext-installer.sh
Created November 10, 2019 08:00
ERPNext installer
#!/bin/bash
# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@daif
daif / lamp-ubuntu-18-04.sh
Created December 8, 2019 08:07
LAMP installer
#!/bin/bash
# Copyright (C) 2019 Daif Alazmi
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
a_btw src_dom fn g dor origin dor id m_sent m_recvd
Feb-24 tinder+misc aakanksha f indian 4/7/2020 93445 21 12
Feb-24 tinder+misc aarti devi f indian 7/9/2018 45238 12 32
Feb-24 tinder+misc charu f indian 10/28/2018 84501 25 2
Feb-24 tinder+misc kranti sharma f indian 4/19/2020 24658 19 34
Feb-24 tinder+misc neha f indian 9/1/2020 68074 17 10
Feb-24 tinder+misc nilam devi f indian 3/2/2018 94001 5 28
Feb-24 tinder+misc pooja jayshwal f indian 7/31/2020 17216 17 28
Feb-24 tinder+misc preeti gupta f indian 4/24/2018 46411 6 26
Feb-24 tinder+misc preeti sinha f indian 6/22/2021 10451 9 23
@daif
daif / metabase-installer.sh
Created March 21, 2020 11:42
MetaBase 0.34.3 installer
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the