Skip to content

Instantly share code, notes, and snippets.

View susthitsoft's full-sized avatar
🎯
Focusing

susthitsoft

🎯
Focusing
View GitHub Profile
@susthitsoft
susthitsoft / generate_icons.sh
Created October 16, 2018 18:03 — forked from AKiniyalocts/generate_icons.sh
Generate resized icons for your android applications using imagemagick!
#!/bin/bash
# This requires imagemagick (a super awesome image tool)
# Install via: sudo apt-get install imagemagick
echo "Enter the path to the 512x512 icon"
read icon
mkdir "drawable-mdpi" "drawable-hdpi" "drawable-xhdpi" "drawable-xxhdpi" "drawable-xxxhdpi"
@susthitsoft
susthitsoft / converter.sh
Created October 8, 2018 16:51 — forked from Kishanjvaghela/converter.sh
Create Image drawable for all resolutions
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else if [ -f "$1" ]; then
echo " Creating different dimensions (dips) of "$1" ..."
mkdir -p drawable-xxhdpi
mkdir -p drawable-xhdpi
mkdir -p drawable-hdpi
mkdir -p drawable-mdpi
if [ $1 = "ic_launcher.png" ]; then
@susthitsoft
susthitsoft / Dockerfile
Created September 24, 2018 11:04 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
@susthitsoft
susthitsoft / app.py
Created September 17, 2018 09:26 — forked from gthole/app.py
Simple Flask Proxy
from flask import Flask, request, abort
import hashlib
import json
import requests
import os
app = Flask(__name__)
app.config['CAPTURE'] = bool(os.environ.get('CAPTURE'))
app.config['CACHE_DIR'] = os.environ.get('CACHE_DIR', '/tmp/cache')
@susthitsoft
susthitsoft / generate-pushid.js
Created August 18, 2018 18:33 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
import random
import time
import numpy
from exceptions import ValueError
class PushID(object):
# Modeled after base64 web-safe chars, but ordered by ASCII.
PUSH_CHARS = ('-0123456789'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@susthitsoft
susthitsoft / export_db.js
Created August 1, 2018 18:22 — forked from sturmenta/firestore2json.js
firestoreDB to JSON to firestoreDB
const admin = require('firebase-admin');
const fs = require('fs');
var serviceAccount = require('../../../../../../Private/myschool-data_transfer-key.json'); //how to setup your keys https://hackernoon.com/filling-cloud-firestore-with-data-3f67d26bd66e
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) });
const schema = { //only collection names
feedback: {},
schools: {
califications: {},
@susthitsoft
susthitsoft / copyFirestoreDB.js
Created August 1, 2018 18:19 — forked from brunobraga95/copyFirestoreDB.js
Copy firestore database
const firebase = require('firebase-admin');
var serviceAccountSource = require("./source.json"); // source DB key
var serviceAccountDestination = require("./destination.json"); // destiny DB key
const sourceAdmin = firebase.initializeApp({
credential: firebase.credential.cert(serviceAccountSource)
});
const destinyAdmin = firebase.initializeApp({
const admin = require('firebase-admin');
var serviceAccount = require("./your-firestore-key.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const dumped = {};
const schema = {
@susthitsoft
susthitsoft / create-superuser.py
Created July 20, 2018 11:41 — forked from c00kiemon5ter/create-superuser.py
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
"""
Extend createsuperuser command to allow non-interactive creation of a
superuser with a password.
Instructions:
mkdir -p path-to-your-app/management/commands/
touch path-to-your-app/management/__init__.py
touch path-to-your-app/management/commands/__init__.py