Skip to content

Instantly share code, notes, and snippets.

@daviddang91
daviddang91 / gist:dec70c90b8a5d0333782d3e0b8dfd852
Created February 27, 2020 03:10 — forked from pingwping/gist:92219a8a1e9d44e1dd8a
Create and update embedded documents with MongoEngine
# REF: http://www.quora.com/How-do-I-create-and-update-embedded-documents-with-MongoEngine
class Comment(EmbeddedDocument):
content = StringField()
name = StringField(max_length=120)
class Post(Document):
title = StringField(max_length=120, required=True)
author = StringField(required=True)
@daviddang91
daviddang91 / fontawesome-scss-in-nextjs.md
Created January 29, 2020 14:33 — forked from mehmetnyarar/fontawesome-scss-in-nextjs.md
Loading FontAwesome with SCSS in NextJS

Loading FontAwesome with SCSS in NextJS

Install Plugins

Install these two plugins:

Edit Configuration File

Keybase proof

I hereby claim:

  • I am daviddang91 on github.
  • I am daviddang91 (https://keybase.io/daviddang91) on keybase.
  • I have a public key ASDjkzMf5dZBk14mhdkdzhL3iF2zunRXNrJa_HaVfM_Q9Ao

To claim this, I am signing this object:

@daviddang91
daviddang91 / supervisor.conf
Created October 2, 2019 09:00 — forked from tsabat/supervisor.conf
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@daviddang91
daviddang91 / graphite_install.sh
Created September 12, 2019 10:55 — forked from amoslanka/graphite_install.sh
Install StatsD on an Ubuntu box, including creating an upstart service and the option to build a graphite box or configure Librato as a backend.
#
# Assumes an independent box (we'll call this one "graphite")
#
# Stay up to date
sudo apt-get update
sudo apt-get upgrade
# Install git
sudo apt-get install g++ curl libssl-dev -y

Keybase proof

I hereby claim:

  • I am daviddang91 on github.
  • I am daviddang91 (https://keybase.io/daviddang91) on keybase.
  • I have a public key ASATQyTTpUH_zlGdIpD8QcIflNsfweHr14QoVIGyCwa8Pwo

To claim this, I am signing this object:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
name: test
spec:
replicas: 1
template:
metadata:
creationTimestamp: null
@daviddang91
daviddang91 / axios-catch-error.js
Created June 14, 2019 06:47 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@daviddang91
daviddang91 / readme.md
Created February 20, 2019 07:06 — forked from fabiopiovam/readme.md
Django deploy using Nginx + Gunicorn + Supervisor

Django deploy using Nginx + Gunicorn + Supervisor

Introduction

This implementation was made using Debian 8.

Requirements

  • Install packages:

    aptitude install nginx supervisor
    
@daviddang91
daviddang91 / minikubedelete
Created January 16, 2019 03:52 — forked from sharepointoscar/minikubedelete
Minikube - Delete all pods from default namespace
# delete all pods
kubectl delete --all pods --namespace=default
# deete all deployments
kubectl delete --all deployments --namespace=default
# delete all services
kubectl delete --all services --namespace=default