Skip to content

Instantly share code, notes, and snippets.

@jcfrank
jcfrank / init.vim
Last active May 12, 2024 08:44
My neovim init.vim
"" customize settings
"set number
set relativenumber
set showmatch
set ignorecase
set confirm
set shiftwidth=4
set tabstop=8
set softtabstop=4
set expandtab
@jcfrank
jcfrank / azure-key-credentials.py
Last active November 3, 2022 07:16 — forked from vinodc/azure-key-credentials.py
Python script to print out information to configure an Azure app's keyCredentials entry.
#!/usr/bin/env python3
import os
import sys
from base64 import b64encode
from uuid import uuid4
try:
from cryptography import x509
from cryptography.hazmat.backends import default_backend
@jcfrank
jcfrank / nginx-https-proxy.md
Last active August 29, 2015 14:15
nginx reverse proxy for https example

Virtual host config

Generally put under /etc/nginx/sites-available/, then put soft link under /etc/nginx/sites-enabled/.
ex. /etc/nginx/sites-available/https_proxy

upstream actual {
        server actual-hostname:443;
        server actual-hostname2:443;
}

server {
@jcfrank
jcfrank / sort-file-size.md
Created January 30, 2015 03:26
sort files in current folder by sizes

List files in current folder and sort by their sizes.

find . -type f -print0 | du -a --files0-from=- | sort -n

Output example

...
@jcfrank
jcfrank / jersey2-mvc-sample.md
Last active February 26, 2021 13:14
A basic Jersey 2 mvc sample with Mustache.

Jersey 2 MVC

Jersey 2 also supports server-side template rendering.
This is a simple mustache sample.

Gradle

build.gradle
Add jerset mvc dependencies.

@jcfrank
jcfrank / erlang-websocket-sample.md
Last active November 3, 2022 07:15
A simple erlang cowboy websocket app

Simple Cowboy websocket app

Cowboy is such a simple web framework.
This is a sample websocket app.

new project

Use erlang.mk. Not that you have to, but it'd make things a bit easier.
First, create a folder for project, ex. myproject.
$ cd myproject/

@jcfrank
jcfrank / emacs-cheatsheet.md
Last active March 18, 2018 15:17
Emacs cheat sheet.

Emacs 24.3 cheat sheet

Keys Desc
C-x C-c quit
M-x kill-emacs quit without saving
C-x s Save, Promt
C-x C-s Save
C-@ Mark mode
@jcfrank
jcfrank / django-sample.md
Last active August 29, 2015 14:13
A django app sample. Only to remind myself how to set up django urls and views.

Simple Django app

New a root app

$ django-admin.py startproject mysite
$ cd mysite
$ python manage.py startapp myrestapp

mysite/settings.py

@jcfrank
jcfrank / flask-sample.md
Last active August 29, 2015 14:13
A flask restful api server sample.

Simple Flask app

This snippet is from an API server of another open source project.
It was written to work with webpy, but I change it to use Flask.

requirements:

flask
flask-restful
@jcfrank
jcfrank / emberjs-sample.md
Last active August 29, 2015 14:13
A basic ember rest client sample. Useful for demo page.

Simple Emberjs app

Backend

Dependencies:

  "dependencies": {
    "jade": "*",
    "coffee-script": "*",