Skip to content

Instantly share code, notes, and snippets.

View harwee's full-sized avatar

Sri Harsha Gangisetty harwee

View GitHub Profile
@harwee
harwee / svgfixer.js
Created February 15, 2020 14:48 — forked from leonderijke/svgfixer.js
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
# Fix permissions for proxy models.
# Derived from https://gist.github.com/magopian/7543724#gistcomment-2561169
import sys
from django.core.management.base import BaseCommand
from django.apps import apps
from django.utils.encoding import smart_text
from django.contrib.auth.management import _get_all_permissions
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
@harwee
harwee / copy_volumes_to_host.sh
Last active November 6, 2018 10:08
Copy Docker volumes to another host (AWS Instances)
## Remote host address where you want to copy the volumes
REMOTE_HOST="<HOST_ADDRESS>"
## User of remote host
REMOTE_HOST_USER="<REMOTE_HOST_USER>" ## ex: ubuntu
## PEM KEY File for the remote Host
REMOTE_HOST_PEM_PATH="<PATH_TO_PEM_FILE>"
## Iterate over all volumes in local system
0x148D902aEc968DE888B516a1B646a0616FfDF800
import os
import pkg_resources
import sys
from setuptools.archive_util import unpack_archive
def unpackEgg(modulo):
eggs = pkg_resources.require(modulo)
for egg in eggs:
if os.path.isdir(egg.location):
sys.path.insert(0, egg.location)
@harwee
harwee / tensorflow_self_check.py
Last active August 14, 2017 05:24 — forked from mrry/tensorflow_self_check.py
TensorFlow on Windows self-check
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@harwee
harwee / tweet_dumper.py
Created September 20, 2016 12:38 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""