Skip to content

Instantly share code, notes, and snippets.

View dmutende's full-sized avatar
🏠
Working from home

Derek Prince dmutende

🏠
Working from home
View GitHub Profile
@dmutende
dmutende / postman-deb.sh
Last active August 5, 2019 09:20 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
script=`basename "$0"`
if [ $# -gt 0 ] && [ "$1" = "-e" ]; then
e="-e"
fi
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
@dmutende
dmutende / types.py
Created March 12, 2019 12:49
GraphQL Show Record Count (Total Count)
# .../site-packages/graphene_django/types.py
#......
class DjangoObjectType(ObjectType):
@classmethod
def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=False,
only_fields=(), exclude_fields=(), filter_fields=None, connection=None,
## use_connection=None, interfaces=(), **options):
connection_class=None, use_connection=None, interfaces=(), **options):
assert is_valid_django_model(model), (
@dmutende
dmutende / ERC20.sol
Created October 18, 2018 10:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity ^0.4.24;
import "./IERC20.sol";
import "./SafeMath.sol";
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
@dmutende
dmutende / oauth2_graphql_readme.txt
Last active January 16, 2020 16:35
Warpping GraphQL endpoints with Django OAuth2 Toolkit's ProtectedResourceView to secure them using OAuth2.0
- create a .py file with 2 classes (OAuth2ProtectedResourceMixin and OAuth2ProtectedGraph). see 'utils.py' file
- then in your Django's 'urls.py', wrap the graphql endpoint. see 'urls.py.
@dmutende
dmutende / owner_to.sh
Last active July 8, 2020 08:33
ALTER owner to tables, sequences and views on PostgreSQL databases using bash
#!/bin/bash
DB=[YOUR_DB_NAME]
OWNER=[NEW_OWNER]
# alter tables owner
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" $DB` ; do psql -c "alter table \"$tbl\" owner to $OWNER" $DB ; done
# alter sequences owner
for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" $DB` ; do psql -c "alter table \"$tbl\" owner to $OWNER" $DB ; done