For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
| { | |
| "name": "Gruvbox custom 1", | |
| "is_dark": true, | |
| "colors": { | |
| "accent-color": "#bd93f9", | |
| "primary-color": "#fe8019", | |
| "warning-color": "#fb4934", | |
| "sidebar-color": "#282828", | |
| "roomlist-background-color": "#1d2021", | |
| "roomlist-text-color": "#a89984", |
| { | |
| "name": "Gruvbox custom", | |
| "is_dark": true, | |
| "colors": { | |
| "accent-color": "#bd93f9", | |
| "primary-color": "#fe8019", | |
| "warning-color": "#fb4934", | |
| "sidebar-color": "#282828", | |
| "roomlist-background-color": "#1d2021", | |
| "roomlist-text-color": "#a89984", |
| { | |
| "name": "Gruvbox", | |
| "is_dark": true, | |
| "colors": { | |
| "accent-color": "#bd93f9", | |
| "primary-color": "#fe8019", | |
| "warning-color": "#fb4934", | |
| "sidebar-color": "#282828", | |
| "roomlist-background-color": "#1d2021", | |
| "roomlist-text-color": "#a89984", |
| { | |
| "name": "No bs theme", | |
| "is_dark": false, | |
| "colors": { | |
| } | |
| } |
| // CustomTime provides an example of how to declare a new time Type with a custom formatter. | |
| // Note that time.Time methods are not available, if needed you can add and cast like the String method does | |
| // Otherwise, only use in the json struct at marshal/unmarshal time. | |
| type CustomTime time.Time | |
| const ctLayout = "2006-01-02 15:04:05 Z07:00" | |
| // UnmarshalJSON Parses the json string in the custom format | |
| func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) { |
| #OSX Tweaks: | |
| =========== | |
| - Most need reboot to show changes | |
| - Most of these tweaks are just for speed, but some are specific for development | |
| - All of these are to be ran in terminal. The commands to be copy and pasted start after the less-than sign. | |
| - I'm not responsible for any adverse effects to your computer, at all. | |
| ##Increase the speed of OS X dialogs boxes: |
| import os | |
| import re | |
| def fish_to_zsh(cmd): | |
| return (cmd.replace('; and ', '&&') | |
| .replace('; or ', '||')) | |
| with open(os.path.expanduser('~/.zsh_history.test'), 'a') as o: | |
| with open(os.path.expanduser('~/.local/share/fish/fish_history')) as f: | |
| for line in f: |
| server { | |
| listen 9999; | |
| # This is the key. | |
| error_page 405 =200 $uri; | |
| location /test { | |
| add_header 'Content-Type' 'application/json' always; | |
| alias /Users/me/abc.json; | |
| } | |
| } |
| func getCookie(name string, r interface{}) (*http.Cookie, error) { | |
| rd := r.(*http.Request) | |
| cookie, err := rd.Cookie(name) | |
| if err != nil { | |
| return nil, err | |
| } | |
| return cookie, nil | |
| } | |
| func setCookie(cookie *http.Cookie, w interface{}) error { |