# Dockerfile
FROM ubuntu:latest
LABEL maintainer="Your Name <[email protected]>"
# Install OpenSSH server and sudo
RUN apt update && apt install -y openssh-server sudo
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
| # create group and user | |
| RUN groupadd -r myapp && useradd -g myapp myapp | |
| # set ownership and permissions | |
| RUN chown pr myapp:myapp /app | |
| # switch to user | |
| USER myapp | |
| CMD node index.js |
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 gitpod/openvscode-server:latest | |
| SHELL ["/bin/bash", "-c"] | |
| ENV OPENVSCODE_SERVER_ROOT="/home/.openvscode-server" | |
| ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server" | |
| ENV SERVER_BASE_PATH="/code/xyz" | |
| USER root | |
| RUN apt update -y |
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 sqlite3 = require('sqlite3').verbose(); | |
| let db = new sqlite3.Database(':memory:'); | |
| let db = new sqlite3.Database(':memory:', (err) => { | |
| if (err) { | |
| return console.error(err.message); | |
| } | |
| console.log('Connected to the in-memory SQlite database.'); | |
| }); |
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
| variables: | |
| GIT_USER_NAME: "Build Bot" | |
| GIT_USER_EMAIL: "[email protected]" | |
| GIT_REPO_URL: "[email protected]:username/repo_name.git" | |
| CI_PROJECT_ID: "1002" | |
| CI_JOB_TOKEN: $GH_TOKEN | |
| GL_TOKEN: $GH_TOKEN | |
| GL_SSH_KNOWN_HOSTS: $SSH_HOST_KEY | |
| GL_SSH_PRIVATE_KEY: $SSH_PRIVATE_KEY |
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
| declare global { | |
| var foo: string; | |
| } | |
| globalThis.foo = 'Welcome !!!'; | |
| // foo value can be checked on browser console |
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 shortPolling = (fn, interval) => { | |
| let counter = 1; | |
| const _interval = interval || 1000; | |
| const next = (params) => { | |
| setTimeout(() => { | |
| counter += 1; | |
| fn(next, counter, params); | |
| }, _interval); | |
| }; | |
| fn(next, counter); |
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
| async function fetchGoogleSheetFeed({spreadsheetId, sheetNum}) { | |
| const tab = sheetNum || 1; | |
| const fetchUrl = `https://spreadsheets.google.com/feeds/cells/${spreadsheetId}/${tab}/public/full?alt=json`; | |
| const data = await fetch(fetchUrl).then(response => { | |
| if(response.status === 200) { | |
| return response.json(); | |
| } else { | |
| return { feed: { entry: [] }}; | |
| } | |
| }); |
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 React from 'react'; | |
| import { Field } from 'react-final-form'; | |
| const withFinal = Component => { | |
| const { finalProps: fnlProps } = Component; | |
| // eslint-disable-next-line react/prop-types | |
| const fieldRenderer = ({ input, ...rest }) => { | |
| let extented = {}; | |
| if (fnlProps) { | |
| const keys = Object.keys(fnlProps); |
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
| var http = require('http'); | |
| var url = require('url'); | |
| function processPost(request, response, callback) { | |
| var queryData = ""; | |
| if(typeof callback !== 'function') return null; | |
| if(request.method == 'POST') { | |
| request.on('data', function(data) { | |
| queryData += data; |
NewerOlder