Skip to content

Instantly share code, notes, and snippets.

View Cerebro92's full-sized avatar
🎯
Focusing

Neeraj Gahlot Cerebro92

🎯
Focusing
View GitHub Profile
@Cerebro92
Cerebro92 / extensible-integer-choices.py
Last active January 26, 2023 13:00
Demonstrates extensible Integer Choice.
from django.db import models
from django.utils.functional import classproperty
class InheritableIntegerChoicesMeta(type):
def __init__(cls, name, bases, attrs):
super().__init__(name, bases, attrs)
choices = []
for c in cls.mro():
choices += [(value, name) for name, value in c.__dict__.items() if not callable(value) and not name.startswith("__") and name != "choices"]
@Cerebro92
Cerebro92 / psycopg2-python.md
Last active December 13, 2022 16:03
Install python package psycopg2 on macos

export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"

pip install psycopg2

// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
contract EtherStore {
mapping(address => uint) balances;
bool internal locked;
// modifier noReentrant(){
// require(!locked, "No re-entrancy");
@Cerebro92
Cerebro92 / permutation.py
Created May 22, 2019 15:42
List Permutations
import copy
final = []
def main(Arr, res):
if not Arr:
final.append(res)
return
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', "{{settings}}"]);
_gaq.push(['_setDomainName', '{{domain}}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);