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
use std::fs::File; | |
use std::io::Read; | |
fn main() | |
{ | |
let mut file = File::open("file2").unwrap(); | |
for byte in file.bytes() { | |
match byte { | |
Ok(v) => println!("{:b}", v),// or {:x} for hex |
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
process.on('SIGTERM', () => console.log('term')) | |
process.on('SIGINT', () => console.log('int')) | |
process.on('SIGHUP', () => console.log('hup')) | |
setInterval(() => console.log('doing useless work!'), 10000) |
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!') |
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
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
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
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
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}" |