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 http = require("http"); | |
| const https = require("https"); | |
| const AWS = require('aws-sdk'); | |
| const formidable = require("formidable"); | |
| const uuid = require("uuid"); | |
| let server = http.createServer(launch); | |
| let s3 = new AWS.S3({ | |
| // s3 credentials | |
| }); |
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
| // Test this by running the code snippet below and then | |
| // use the "Offline" checkbox in DevTools Network panel | |
| window.addEventListener('online', handleConnection); | |
| window.addEventListener('offline', handleConnection); | |
| function handleConnection() { | |
| if (navigator.onLine) { | |
| isReachable(getServerUrl()).then(function(online) { | |
| if (online) { |
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 items = json3.items | |
| const replacer = (key, value) => value === null ? '' : value // specify how you want to handle null values here | |
| const header = Object.keys(items[0]) | |
| let csv = items.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(',')) | |
| csv.unshift(header.join(',')) | |
| csv = csv.join('\r\n') | |
| console.log(csv) |
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 { Injectable } from '@angular/core'; | |
| import { HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import 'rxjs/add/operator/mergeMap'; | |
| import { AuthService } from './auth.service'; | |
| @Injectable() | |
| export class TokenInterceptor implements HttpInterceptor { |
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
| # Optimizing postgresql table for more than 100K inserts per second | |
| * Create `UNLOGGED` table. This reduces the amount of data written to persistent storage by up to 2x. | |
| * Set `WITH (autovacuum_enabled=false)` on the table. This saves CPU time and IO bandwidth | |
| on useless vacuuming of the table (since we never `DELETE` or `UPDATE` the table). | |
| * Insert rows with `COPY FROM STDIN`. This is the fastest possible approach to insert rows into table. | |
| * Minimize the number of indexes in the table, since they slow down inserts. Usually an index | |
| on `time timestamp with time zone` is enough. | |
| * Add `synchronous_commit = off` to `postgresql.conf`. | |
| * Use table inheritance for fast removal of old data: |
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
| #Login as root | |
| sudo su | |
| #create jdk directory | |
| mkdir /opt/jdk | |
| #uncompress, change to your file name | |
| tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk | |
| #check if files are there |
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
| version: '2' | |
| services: | |
| myapp: | |
| build: . | |
| container_name: "myapp" | |
| image: debian/latest | |
| environment: | |
| - NODE_ENV=development | |
| - FOO=bar | |
| volumes: |
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
| https://github.com/cloudfoundry/uaa | |
| http://docs.cloudfoundry.org/api/uaa/version/74.4.0/index.html#overview | |
| https://docs.cloudfoundry.org/concepts/architecture/uaa.html | |
| https://www.baeldung.com/cloud-foundry-uaa | |
| React | |
| https://medium.com/@thechrisbull/4-different-kinds-of-components-creating-a-react-ui-component-framework-saga-a-designer-9043c0cc597 |
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
| upstream warehouse_inventory { | |
| zone inventory_service 64k; | |
| server 10.0.0.1:80; | |
| server 10.0.0.2:80; | |
| server 10.0.0.3:80; | |
| } | |
| upstream warehouse_pricing { | |
| zone pricing_service 64k; | |
| server 10.0.0.7:80; |
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
| FROM ubuntu | |
| MAINTAINER Kimbro Staken | |
| RUN apt-get install -y python-software-properties python python-setuptools ruby rubygems | |
| RUN add-apt-repository ppa:chris-lea/node.js | |
| RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list | |
| RUN apt-get update | |
| RUN apt-get install -y nodejs | |
| RUN apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 |
NewerOlder