Skip to content

Instantly share code, notes, and snippets.

<template>
<q-page
class="window-height window-width row justify-center items-center"
style="background: linear-gradient(#8274C5, #5A4A9F);"
>
<div class="column q-pa-lg">
<div class="row">
<q-card square class="shadow-24" style="width:300px;height:485px;">
<q-card-section class="bg-deep-purple-7">
<h4 class="text-h5 text-white q-my-md">Company &amp; Co</h4>
@a4amaan
a4amaan / bitbucket-pipelines.yml
Created March 23, 2021 10:51 — forked from cabrerahector/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploying to Server with atlassian/ftp-deploy
image: atlassian/default-image:2
pipelines:
branches:
master:
- step:
name: Deploy to Production
deployment: production
script:
@a4amaan
a4amaan / flask-admin-with-flask-basicauth-login-example.py
Created March 19, 2021 20:12 — forked from shisaq/flask-admin-with-flask-basicauth-login-example.py
flask-admin with flask-basicauth login example(Flask-BasicAuth简单登录Flask-admin后台)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# flask related modules
from flask import Flask, Response
from flask_basicauth import BasicAuth
from flask_admin import Admin
from flask_admin.contrib import sqla
from werkzeug.exceptions import HTTPException
# database set up
@a4amaan
a4amaan / jwtRS256.sh
Created February 12, 2021 20:32 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@a4amaan
a4amaan / setup
Last active November 19, 2020 10:50
Setup Alluxio Presto Hive
=============================== Setup alluxio With Proxy ===============================
Get IP Address by ifconfig and replace below ip address:
docker volume create ufs
docker network create alluxio_network
docker run -d --rm -p 19999:19999 -p 19998:19998 -p 39999:39999 --net=alluxio_network --name=alluxio-master -v /data/master:/opt/alluxio/logs -v ufs:/opt/alluxio/underFSStorage -e ALLUXIO_JAVA_OPTS="-Dalluxio.master.hostname=alluxio-master -Dalluxio.master.mount.table.root.ufs=/opt/alluxio/underFSStorage -Dalluxio.user.file.delete.unchecked=true -Dalluxio.user.file.writetype.default=CACHE_THROUGH -Dalluxio.user.file.ufs.tier.enabled=true -Dalluxio.security.authorization.permission.umask=000" alluxio/alluxio master
docker run -d --rm -p 29999:29999 -p 29998:29998 -p 30000:30000 --net=alluxio_network --name=alluxio-worker-1 -v /data/worker:/opt/alluxio/logs -v ufs:/opt/alluxio/underFSStorage --shm-size=16G -e ALLUXIO_JAVA_OPTS="-D
@a4amaan
a4amaan / mysql.txt
Created November 10, 2020 14:46
Dockerized Mysql Setup
https://towardsdatascience.com/connect-to-mysql-running-in-docker-container-from-a-local-machine-6d996c574e55
docker volume create mysql-volume
docker run --name=mysql -p 3306:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:8.0.20
docker exec -it mysql mysql -u root -p
password
update mysql.user set host = '%' where user='root';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
@a4amaan
a4amaan / exception.py
Created October 25, 2020 17:52
DRF Global Exception Handler
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework.exceptions import ValidationError as DRFValidationError
from rest_framework.exceptions import AuthenticationFailed as DRFAuthenticationFailed
from rest_framework.views import exception_handler as drf_exception_handler
def exception_handler(exc, context):
"""Handle Django ValidationError as an accepted exception
@a4amaan
a4amaan / rest
Created October 14, 2020 04:54
drf settings
import datetime
from .base import SECRET_KEY
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
@a4amaan
a4amaan / webhook.py
Created September 11, 2020 11:08 — forked from Bilka2/webhook.py
Simple discord webhook with python
import requests #dependency
import json
url = "<your url>" #webhook url, from here: https://i.imgur.com/aT3AThK.png
data = {}
#for all params, see https://discordapp.com/developers/docs/resources/webhook#execute-webhook
data["content"] = "message content"
data["username"] = "custom username"
@a4amaan
a4amaan / scrape.py
Created August 4, 2020 06:34
Scrape Data from WorldoMeter
import os
from datetime import datetime, timezone, timedelta
import psycopg2
from bs4 import BeautifulSoup
import requests
import re
from aman.countries import find
url = "https://www.worldometers.info/coronavirus/"