Skip to content

Instantly share code, notes, and snippets.

View ajaidanial's full-sized avatar
👨‍💻
High On Code

Ajai Danial ajaidanial

👨‍💻
High On Code
View GitHub Profile
@leibowitz
leibowitz / adapter.js
Last active July 29, 2024 08:28
AdminBro Many to Many component for sequelizejs
const { Database, Resource: SequelizeResource } = require('admin-bro-sequelizejs')
const { BaseRecord } = require('admin-bro')
const { Op } = require('sequelize')
class Resource extends SequelizeResource {
titleField() {
return this.decorate().titleProperty().name()
}
@VKen
VKen / docker-start-celery-multi-worker-entrypoint
Created September 19, 2019 03:57
Running celery multi in docker container with running logs, signal trap, and graceful shutdown & restart
#!/bin/sh
# safety switch, exit script if there's error. Full command of shortcut `set -e`
set -o errexit
# safety switch, uninitialized variables will stop script. Full command of shortcut `set -u`
set -o nounset
# tear down function
teardown()
{
@4410287
4410287 / postgres-backup.sh
Created January 9, 2019 16:32
Shell script for daily postgres database backup with basic archiving.
#!/bin/bash
# Written 2018-11-15 by 4410287
# This script will create a backup file of a postgres database and compress it. It is capable of access a local or remote server to pull the backup. After creating a new backup, it will delete backups that are older than 15 days, with the exception of backups created the first of every month. It is recommended to create a seperate database user specifically for backup purposes, and to set the permissions of this script to prevent access to the login details. Backup scripts for different databases should be run in seperate folders or they will overwrite each other.
HOSTNAME=
USERNAME=
PASSWORD=
DATABASE=
@VinayakBagaria
VinayakBagaria / .editorconfig
Last active January 8, 2024 15:23
Prettier, ESLint, Husky, Lint-Staged, Editorconfig for React (Web/Native)
# look for an .editorconfig file inside this project
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
# while saving
insert_final_newline = true
@rbtsolis
rbtsolis / middleware.py
Created May 3, 2018 02:46
Django Access the Request or User Object Inside the Models and Signals
# 1) Create a middlewares/middlewares.py file and copy this:
import threading
class RequestMiddleware:
def __init__(self, get_response, thread_local=threading.local()):
self.get_response = get_response
self.thread_local = thread_local
# One-time configuration and initialization.
@csamsel
csamsel / convert-ssl.sh
Last active September 26, 2024 03:36
convert ssl certificates from pem to crt/key
openssl rsa -outform der -in privkey.pem -out privkey.key
openssl x509 -outform der -in fullchain.pem -out fullchain.crt
openssl x509 -outform der -in cert.pem -out cert.crt
@Dev-Dipesh
Dev-Dipesh / nginx-ssl.md
Last active September 23, 2024 15:46
Setting SSL/TLS in Nginx Using Godaddy as CA Provider

CA PROVIDER - GODADDY

Certificates

Ones you have generated, downloaded and extracted the certificate zip, you will find 2 files in it:

  • gd_bundle-g2-g1.crt Intermediate Certificate
  • RANDOM_NUM.crt Your SSL Certificate

Creating single chained certificate

@mau21mau
mau21mau / README.md
Last active March 23, 2025 23:26
Configure Celery + Supervisor With Django
@sharshenov
sharshenov / gist:edaca25b3b9094359c95f4ae66cd4222
Created July 22, 2016 16:55
Using wkhtmltopdf without X server
apt-get install wkhtmltopdf
apt-get install xvfb
echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh
chmod a+x /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com output.pdf
@iraquitan
iraquitan / mac-brew-python3-postgresql-psycopg2
Created July 7, 2016 14:52
PostgreSQL and psycopg2 initial setup on Mac with Homebrew and Python 3
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install postgresql
brew install postgresql
# start homebrew postgresql service
brew service start postgresql
# create a database with your username