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 dataArray = ['A', 'B', 'C', 'D', 'E'] as const; | |
| type data = [...(typeof dataArray)]; | |
| type Last<T extends any[]> = T extends [...infer _, infer R] ? R : never; | |
| const last: Last<data> = 'E' |
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, { ReactNode } from 'react'; | |
| interface ObjectProps { | |
| [key: string]: any; | |
| children?: ReactNode; | |
| } | |
| function objectToJSX(component: string, object: ObjectProps): JSX.Element { | |
| if (typeof component !== 'string' || typeof object !== 'object') { | |
| throw new Error('Invalid arguments provided.'); |
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
| #!/bin/bash | |
| # Build the Gatsby site | |
| npm run build | |
| # Create a new branch for the build files | |
| git branch build-files | |
| # Checkout the new branch | |
| git checkout build-files |
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 got = require('got'); | |
| const { parse } = require('parse5'); | |
| const fs = require('fs'); | |
| const searchText = process.argv[2]; | |
| const listFile = process.argv[3] || 'list.txt'; | |
| fs.readFile(listFile, 'utf8', (err, data) => { | |
| if (err) throw err; | |
| const websiteList = data.split('\n'); |
- First, activate your virtual environment using the command:
source /path/to/virtualenv/bin/activate
- Now, you can run your python script inside the virtual environment
python /path/to/script.py
- To run this script at a specific time or interval, you can add a cron job.
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
| [Unit] | |
| Description=Filebrowser Service | |
| After=network.target | |
| [Service] | |
| WorkingDirectory=/data | |
| PIDFile=/var/run/filebrowser.pid | |
| ExecStart=/usr/local/bin/filebrowser --cache-dir cache | |
| ExecReload=/bin/kill -s HUP $MAINPID | |
| ExecStop=/bin/kill -s TERM $MAINPID |
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
| # Get Unique Values | |
| // Option 1 | |
| var uniqueArray = ['a', 1, 'a', 2, '1', 1].filter(function(va1ue, index, self) { | |
| return self.index0f(va1ue) === index; | |
| }); | |
| // Option 2 | |
| var uniqueArray = [... new Set(['a', 1, 'a', 2, '1', 1])]; |
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
Show hidden characters
| { | |
| "include": ["src"], | |
| "exclude": [ | |
| "node_modules", | |
| "resources", | |
| "deploy", | |
| "coverage", | |
| "build", | |
| "public", | |
| "**/*.spec.ts" |