Skip to content

Instantly share code, notes, and snippets.

View mikeshultz's full-sized avatar

Mike Shultz mikeshultz

View GitHub Profile
@DanielVF
DanielVF / README.md
Created March 20, 2023 13:53
Visualize Code Changes

This vis code is not generalized - you will need to change it to extra the code you want.

Get changes:

git log --pretty=format:%H --reverse NAMEOFBRANCH -- contracts/vault/VaultCore.sol | xargs -n 1 -I {} git show {}:contracts/contracts/vault/VaultCore.sol | grep -A 150 'function NAME_OF_FUNCTION' >versions.txt
python animate.py
@andresriancho
andresriancho / get-display-name.py
Last active December 5, 2023 13:29
Get AWS root account email address
import boto3
session = boto3.Session(profile_name='ariancho')
s3_client = session.client('s3')
display_name = s3_client.list_buckets()['Owner']['DisplayName']
print(display_name)
for bucket in s3_client.list_buckets()['Buckets']:
print(s3_client.get_bucket_acl(Bucket=bucket['Name'])['Owner']['DisplayName'])
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@ckinsey
ckinsey / decorators.py
Created March 22, 2014 16:34
Require SSL for Django views via a decorator. You'll need some setup in your web server to support the request.is_secure() method--see the Django docs.
from functools import wraps
from django.conf import settings
from django.http import HttpResponseRedirect
def require_ssl(view):
"""
Decorator that requires an SSL connection. If the current connection is not SSL, we redirect to the SSL version of
the page.
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
# -*- coding: utf-8 -*-
from django.db import models
class LtreeField(models.CharField):
"""Field implementation of PostgreSQL ltree type"""
def __init__(self, *args, **kwds):
super(LtreeField, self).__init__(max_length=128, *args, **kwds)