Skip to content

Instantly share code, notes, and snippets.

View paschmaria's full-sized avatar
🏠
Working from home

Paschal Onuorah paschmaria

🏠
Working from home
View GitHub Profile
@paschmaria
paschmaria / git-deployment.md
Created September 1, 2023 01:47 — forked from nonbeing/git-deployment.md
Simple deployment using git's post-receive hook

Also see: https://gist.github.com/lemiorhan/8912188

Simple automated deployment using git hooks

Here are the simple steps needed to push your local git repository directly to a remote (e.g. prod) server over ssh. This is based on Digital Ocean's Tutorial.

Overview

You are developing in a working-directory on your local machine, let's say on the master branch. Usually people push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use GitHub's webhooks to send a POST request to a webserver to take appropriate actions such as cloning/checking out a branch on the remote (prod) server.

@paschmaria
paschmaria / updateCalendar.JS
Last active April 17, 2023 11:49
Code to create a calendar that shows current appointments, and how time progresses like Google Calendar.
import React, { useState, useEffect } from "react";
import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import momentTimezone from "moment-timezone";
const Calendar = () => {
const [events, setEvents] = useState([]);
useEffect(() => {
// Fetch events from API or local storage
@paschmaria
paschmaria / remove_duplicate_querysets.py
Last active February 11, 2021 08:50
Deleting duplicate (multiple occurring) rows from database in Django
# Get all user wallet IDs
wallets = User.objects.all().values_list('wallet', flat=True)
# check total number of wallet ids
wallets.count()
# get unique wallet IDs
unique_wallets = set(list(wallets))
# get total number of unique wallets
len(unique_wallets)
# get duplicate wallet IDs
for item in wallets:
@paschmaria
paschmaria / git-deployment.md
Created September 11, 2020 18:02 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@paschmaria
paschmaria / LICENSE.txt
Created July 26, 2020 17:27 — forked from DWSR/LICENSE.txt
CloudSQL MySQL instance with scheduled exports via Cloud Function. Licensed under Apache 2.0
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
import datetime
import warnings
from django.db import models
from django.db.models.signals import post_delete, post_save, pre_delete
try:
from django.utils.timezone import now
except ImportError:
now = datetime.datetime.now
/* Bootstrap 4.3.1 - https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css
.accordion
.active
.alert
.alert-danger
.alert-dark
.alert-dismissible
.alert-heading
.alert-info
[{"states":{"name":"Abia State","id":1,"locals":[{"name":"Aba North","id":1},{"name":"Aba South","id":2},{"name":"Arochukwu","id":3},{"name":"Bende","id":4},{"name":"Ikwuano","id":5},{"name":"Isiala Ngwa North","id":6},{"name":"Isiala Ngwa South","id":7},{"name":"Isuikwuato","id":8},{"name":"Obi Ngwa","id":9},{"name":"Ohafia","id":10},{"name":"Osisioma","id":11},{"name":"Ugwunagbo","id":12},{"name":"Ukwa East","id":13},{"name":"Ukwa West","id":14},{"name":"Umuahia North","id":15},{"name":"Umuahia South","id":16},{"name":"Umu Nneochi","id":17}]}},{"states":{"name":"Adamawa State","id":2,"locals":[{"name":"Demsa","id":18},{"name":"Fufure","id":19},{"name":"Ganye","id":20},{"name":"Gayuk","id":21},{"name":"Gombi","id":22},{"name":"Grie","id":23},{"name":"Hong","id":24},{"name":"Jada","id":25},{"name":"Lamurde","id":26},{"name":"Madagali","id":27},{"name":"Maiha","id":28},{"name":"Mayo Belwa","id":29},{"name":"Michika","id":30},{"name":"Mubi North","id":31},{"name":"Mubi South","id":32},{"name":"Numan","id":33},{