paru -S rustup
rustup default stable
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
struct State { | |
step: Step, | |
data: Vec<u8>, | |
} | |
impl State { | |
pub fn new() -> Self { | |
Self { step: Step::Initial, data: vec![] } | |
} | |
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
data Alphabet = A Int | B Float | C String | |
cool :: [Alphabet] -> Bool | |
cool [] = error "Should not call `cool` with empty list" | |
cool alphabetList = case alphabetList of | |
[A] -> coolInt alphabetList | |
[B] -> coolFloat alphabetList | |
[C] -> coolString alphabetList | |
_ -> error "Shouldn't call `cool` with list of different variants" | |
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
device_info_output="$(lsusb | grep $1)" | |
device_info_array=($device_info_output) | |
bus_number="${device_info_array[1]}" | |
device_number="${device_info_array[3]::-1}" | |
echo "${bus_number}" | |
echo "${device_number}" |
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 | |
jobs: | |
one: | |
docker: | |
- image: circleci/ruby:2.4.1 | |
steps: | |
- checkout | |
- run: echo "A first hello" | |
- run: sleep 25 | |
two: |
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 resolvable200 = () => new Promise((resolve, reject) => { | |
console.log('resolvable200 begin') | |
resolve(200) | |
console.log('resolvable200 end') | |
}) | |
const rejectable400 = () => new Promise((resolve, reject) => { | |
console.log('rejectable400 begin') | |
reject(400) | |
console.log('rejectable400 end') |
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 node:alpine | |
COPY package.json package.json | |
COPY server.js server.js | |
RUN npm install | |
EXPOSE 8000 |
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
{ | |
"name": "graceful-shutdown", | |
"version": "1.0.0", | |
"description": "Example of graceful shutdown of web server! :)", | |
"main": "server.js", | |
"scripts": { | |
"start": "node server.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], |
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 express = require('express') | |
const app = express() | |
app.get('/wait', (req, res) => { | |
console.log('Started wait!') | |
setTimeout(() => { | |
res.send('Done!') | |
console.log('Done!') |
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 express = require('express') | |
const app = express() | |
app.get('/wait', (req, res) => { | |
console.log('Started wait!') | |
setTimeout(() => { | |
res.send('Done!') | |
console.log('Done!') |