Skip to content

Instantly share code, notes, and snippets.

View xjlin0's full-sized avatar

Jack xjlin0

View GitHub Profile
@mmmcorpsvit
mmmcorpsvit / gist:3614e2396f94fb7bdc555e3b61ec6202
Created September 4, 2020 03:40
Cookiecutter Django, use Postgres + PostGis
You can easy add PostGis following few simple steps:
1. add to `compose\production\django` samewhere in `RUN apt-get update \`
```bash
&& apt-get install -y gdal-bin \
```
2. edit `compose\production\postgres`
change
`FROM postgres:12.3`
@evert0n
evert0n / fields.py
Created November 20, 2019 05:48 — forked from iamahuman/fields.py
Virtual Field for Django
from django.db.models import Field
from django.conf import settings
from django.utils.decorators import cached_property
class VirtualField(object):
"""
A virtual field, mainly used for caching and seamless computed field retrieval.
This acts both like a (cached) property and a virtual field if supported.
"""
@CharlieYe0205
CharlieYe0205 / rvm_install_openssl_fail.md
Last active December 30, 2023 20:18
RVM Install Openssl Fail
rvm pkg install openssl
Requirements installation successful.
Fetching openssl-1.0.1i.tar.gz to /Users/user/.rvm/archives
Extracting openssl to /Users/user/.rvm/src/openssl-1.0.1i.....
Configuring openssl in /Users/user/.rvm/src/openssl-1.0.1i....................
Compiling openssl in /Users/user/.rvm/src/openssl-1.0.1i......................
@JackAtOmenApps
JackAtOmenApps / article_confirm_delete.html
Last active September 1, 2022 15:25
This is a super basic example of using django-summernote to create a knowledgebase app in django (Make sure to pip install django-summernote)
{% extends "base.html" %}
{% load static %}
{% block title %}{% block head_title %}Knowledgebase - Delete {{ article.name }}{% endblock head_title %}{% endblock title %}
{% block content %}
<div class="container-fluid">
<div class="row ml-1 mr-1">
<div class="col-md-12">
@hoksea
hoksea / JS -- change font size & chinese trad simpl
Last active May 2, 2025 16:22
【JS】字號縮放 & 繁簡轉換
All the codes below are collected from the Internet. Gathering below just for easy reference.
@Eng-Fouad
Eng-Fouad / ssl-certs.md
Last active June 23, 2024 05:50
Generate self-signed PKCS#12 SSL certificate and export its keys using Java keytool and openssl.

Steps to generate self-signed PKCS#12 SSL certificate and export its keys:

1- Create PKCS#12 keystore (.p12 or .pfx file)

keytool -genkeypair -keystore myKeystore.p12 -storetype PKCS12 -storepass MY_PASSWORD -alias KEYSTORE_ENTRY -keyalg RSA -keysize 2048 -validity 99999 -dname "CN=My SSL Certificate, OU=My Team, O=My Company, L=My City, ST=My State, C=SA" -ext san=dns:mydomain.com,dns:localhost,ip:127.0.0.1
  • myKeystore.p12 = keystore filename. It can with .pfx extension as well.
  • MY_PASSWORD = password used for the keystore and the private key as well.
  • CN = commonName, it will be shown as certiciate name in certificates list.
  • OU = organizationUnit, department name for example.
@xjlin0
xjlin0 / interviewitems.MD
Created March 6, 2017 15:05 — forked from KWMalik/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@iamahuman
iamahuman / fields.py
Created February 24, 2017 01:37
Virtual Field for Django
from django.db.models import Field
from django.conf import settings
from django.utils.decorators import cached_property
class VirtualField(object):
"""
A virtual field, mainly used for caching and seamless computed field retrieval.
This acts both like a (cached) property and a virtual field if supported.
"""
@xjlin0
xjlin0 / running_app_in_production_locally.markdown
Created October 27, 2016 22:53 — forked from rwarbelow/running_app_in_production_locally.markdown
How to Run a Rails App in Production Locally
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

kill $(ps aux | grep '[d]elayed_job' | awk '{print $2}')
Credit:
http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex