Skip to content

Instantly share code, notes, and snippets.

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

Muhammad Nur Wahid neoreids

🏠
Working from home
View GitHub Profile
@neoreids
neoreids / django_undo_migration.md
Created February 26, 2021 05:16 — forked from repodevs/django_undo_migration.md
How to undo migration in Django

Let say you have migrations like this

project/apps/accounts/migrations
├── 0001_initial.py
├── 0002_historicalprofile_historicaluser.py
├── 0003_auto_20190807_1559.py
├── 0004_auto_20190811_1013.py
@neoreids
neoreids / .ideavimrc
Created December 28, 2020 04:16 — forked from dewaka/.ideavimrc
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" Copy to system clipboard as well
set clipboard+=unnamed
@neoreids
neoreids / .gitlab-ci.yml
Created June 9, 2020 13:39 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@neoreids
neoreids / HowToFixPycURLErrorMacOS.md
Created May 27, 2020 02:34 — forked from webinista/HowToFixPycURLErrorMacOS.md
PycURL error: ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.

Partly pulled from the comments here: pycurl/pycurl#526

May also be a fix for this error:

ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)

If you try to install PycURL and receive this error:

@neoreids
neoreids / pil_s3.py
Created May 11, 2020 22:57 — forked from ghandic/pil_s3.py
Load image from S3 directly into memory as PIL image and write to S3 directly from memory from PIL image
import boto3
from PIL import Image
from io import BytesIO
import os
class S3ImagesInvalidExtension(Exception):
pass
class S3ImagesUploadFailed(Exception):
pass
@neoreids
neoreids / gist:b54657028936e2774b03fc04e2241fcf
Created April 22, 2020 04:05 — forked from aaugustin/gist:2351479
Django: log all database queries in the console
import logging
logger = logging.getLogger('django.db.backends')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
@neoreids
neoreids / validators.py
Created April 14, 2020 09:55 — forked from jrosebr1/validators.py
Validator for files, checking the size, extension and mimetype for Django.
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# @author dokterbob
# @author jrosebr1
import mimetypes
@neoreids
neoreids / Readme.md
Created April 3, 2020 12:59 — forked from leopoldodonnell/Readme.md
Install and run Postgres with an extension using docker-compose

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.

Install

  • Requires docker and docker-compose
  • Clone via http: git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
  • Make load-extensions.sh executable
  • Build the image: docker-compose build
@neoreids
neoreids / http-proxy.go
Created September 30, 2019 07:40 — forked from fabrizioc1/http-proxy.go
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
@neoreids
neoreids / keys.go
Created September 26, 2019 17:17 — forked from sdorra/keys.go
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"