- People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
- Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
- Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
- Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // temporary solution since there is no typescript definition for qiscus, | |
| // TODO: publish this type definition to npm | |
| declare module 'qiscus-sdk-core' { | |
| interface InitOptions { | |
| AppId: string | |
| options?: { | |
| baseUrl?: string | |
| [key: string]: unknown | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "forecast": [1, 2, 3, 4, 5], | |
| "history": [10, 23, 4, 14, 5] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // qiscus-sdk-core@^2 uncompleted type definitions | |
| declare module 'qiscus-sdk-core' { | |
| interface InitOptions { | |
| AppId: string | |
| options?: { | |
| baseUrl?: string | |
| [key: string]: unknown | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import crypto from 'crypto' | |
| import cryptoRandomString from 'crypto-random-string' | |
| const key = 'secret' | |
| const createSignature = (text) => { | |
| const hmac = crypto.createHmac('sha256', key) | |
| hmac.update(text) | |
| return hmac.digest('base64') | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <X11/Xlib.h> | |
| int main(void) { | |
| Display *dpy = XOpenDisplay(":0"); | |
| XKeyboardState x; | |
| XGetKeyboardControl(dpy, &x); | |
| XCloseDisplay(dpy); | |
| printf("led_mask=%lx\n", x.led_mask); | |
| printf("NumLock is %s\n", (x.led_mask & 2) ? "On" : "Off"); |
I hereby claim:
- I am bwyx on github.
- I am bwyx (https://keybase.io/bwyx) on keybase.
- I have a public key ASAk4uqNLElrvOMSohp38UpwbpmL8CyxYx9et5LsT9n7fgo
To claim this, I am signing this object:
With only 5 openssl commands, you can accomplish this. (Please don't change your browser security settings.)
With the following code, you can
- become your own CA
- then sign your SSL certificate as a CA.
- Then import the CA certificate (not the SSL certificate, which goes onto your server) into Chrome/Chromium. (Yes, this works even on Linux.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Summary: Recommended confusable mapping for IDN | |
| # File: confusablesSummary.txt | |
| # Version: 2.1-draft | |
| # Generated: 2010-04-13, 01:33:25 GMT | |
| # Checkin: $Revision: 1.29 $ | |
| # | |
| # For documentation and usage, see http://www.unicode.org/reports/tr39/ | |
| # | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pick = <T, K extends keyof T>(object: T, keys: K[]): Pick<T, K> => { | |
| return Object.assign( | |
| {}, | |
| ...keys.map(key => { | |
| if (object && Object.prototype.hasOwnProperty.call(object, key)) { | |
| return { [key]: object[key] }; | |
| } | |
| }) | |
| ); | |
| }; |