All Docs
Config-files
appveyor.yml
### https://github.com/sindresorhus/appveyor-node/blob/master/appveyor.yml
os: unstable
max_jobs: 5
environment:
matrix:
- platform: x64
cache:
- node_modules
- '%USERPROFILE%\.electron-gyp'
- '%USERPROFILE%\.node-gyp'
install:
- ps: Install-Product node 10.15.3 x64
- set CI=true
- npm install -g npm@latest
- npm install
build: off
matrix:
fast_finish: true
test_script:
- node --version
- npm --version
- npm run build-quick
- npm run test-build
artifacts:
- path: ./build/*.exe
name: executables
- path: ./test/__testResults__
name: results
deploy:
release: myproduct-v$(appveyor_build_version)
description: 'Release description'
provider: GitHub
auth_token:
secure: w086h7SsN4ZengkZWbBcX3yNc9lM9vS0d7KD7ED0OSblaBlaBla ### your encrypted token from GitHub
artifact: executables, results
draft: true
prerelease: true
on:
branch: master
### APPVEYOR_REPO_TAG: true
travis.github.release
.travis-github-release.yaml
sudo: required
dist: trusty
language: node_js
cache:
- npm
- directories:
- ./build
notifications:
email:
on_success: never
on_failure: change
matrix:
include:
- os: linux
node_js: lts/*
install:
- npm install
script:
- npm run download
deploy:
overwrite: true
provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: out/*
skip_cleanup: true
draft: true
.gitignore
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
### Runtime data
pids
*.pid
*.seed
*.pid.lock
### Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
### Coverage directory used by tools like istanbul
coverage
### nyc test coverage
.nyc_output
### Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)## .grunt
### Bower dependency directory (https://bower.io/)
bower_components
### node-waf configuration
.lock-wscript
### Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
### Dependency directories
node_modules/
jspm_packages/
### TypeScript v1 declaration files
typings/
### Optional npm cache directory
.npm
### Optional eslint cache
.eslintcache
### Optional REPL history
.node_repl_history
### Output of 'npm pack'
*.tgz
### Yarn Integrity file
.yarn-integrity
### dotenv environment variables file
.env
.env.test
### parcel-bundler cache (https://parceljs.org/)
.cache
### next.js build output
.next
### nuxt.js build output
.nuxt
### vuepress build output
.vuepress/dist
### Serverless directories
.serverless/
### FuseBox cache
.fusebox/
### DynamoDB Local files
.dynamodb/
travis-firebase-hosting
.travis-firebase-hosting.yaml
sudo: required
dist: trusty
language: node_js
cache:
- npm
- directories:
- ./build
notifications:
email:
on_success: never
on_failure: change
matrix:
include:
- os: linux
node_js: lts/*
install:
- npm install
script:
- npm run build
deploy:
provider: firebase
token:
secure: "YOUR ENCRYPTED token"
project: "myapp-staging"
local_dir: "dist"
skip_cleanup: true
after_deploy:
- npm run after-deploy
.travis-github-pages.yaml
sudo: required
dist: trusty
language: node_js
cache:
- npm
- directories:
- ./build
notifications:
email:
on_success: never
on_failure: change
matrix:
include:
- os: linux
node_js: lts/*
install:
- npm install
script:
- npm run build
deploy:
local_dir: [dist-dir]### e.g. local_dir: ./.vuepress/dist
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
fqdn: [subdomain].[domain].[ext] #e.g.## fqdn: notes.nishkal.in
on:
branch: master
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"outDir": "./dist",
"inlineSourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"lib": [
"es2017",
"dom"
],
"baseUrl": "./",
"module": "umd",
"types": [
"node"
],
"typeRoots": [
"node_modules/@types"
],
"strict": false,
"skipLibCheck": true,
"allowJs": true
},
"include": [
"src/*",
"worker/*"
],
"exclude": [
"**/node_modules/*",
]
}
cloudbuild.yml
steps:
### Decrypt
- name: gcr.io/cloud-builders/gcloud
args:
- kms
- decrypt
- --ciphertext-file=.env.enc
- --plaintext-file=.env
- --location=global
- --keyring=cloud-build-keyring
- --key=cloud-build-key
### install
- name: 'gcr.io/cloud-builders/npm'
args : ['install']
### build
- name: 'gcr.io/cloud-builders/npm'
args : ['run','cloud-build']
### deploy
- name: 'gcr.io/cloud-builders/npm'
args : ['run','deploy-ci']
Snippets
Github encrypt files
Note
View on github: Link
1. Encrypting and decrypting files
- Adding files to a tar archive.
### Where foo and bar are the files you want to encrypt.
tar cvf ./path-to-secrets.tar foo bar
- Encrypting file
gpg --symmetric --cipher-algo AES256 ./path-to-secrets.tar
- Decrypting file
gpg --quiet --batch --yes --decrypt --passphrase="$SECRET_KEY" --output ./path-to-output-file.tar ./path-to-input-gpg-file.gpg
- Extracting the tar archive
### -C is for CWD
tar xvf secrets.tar -C ./out-dir
Node on Linux
Install instructions
Instruction manual: Link
For node 12
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
SSH
1. Generate ssh key
ssh-keygen
// variation
ssh-keygen -t ras
2. Copy to server
// login to server
nano ~/.ssh/authorized_keys
3. Change SSH config
// edit config here
sudo nano /etc/shell/sshd_config
// after editing
sudo systemctl reload sshd
4. Create new user with sudo
$ adduser my-user-name
$ id my-user-name
$ usermod -aG sudo my-user-name
$ id my-user-name
Website plan
Markdown v/s Wordpress CMS
- Cannot use custom components/HTML. See following examples -
What can we do about it?
- You use wordpress (wont be able to help, scalability issues, maintenance e.t.c)
- You learn to write markdown
- OR
- Use wordpress as CMS
- Convert wordpress website to markdown
Type of content
- Exactly as same as fireship.io
- Courses - paid as well as free
- one-to-one video mapping
- quick snippets
- tags
- NOT categories (see below)
Discuss data structure
- Get categories list (Do we even need category?)
- Get tags list
Meta material
- Comments section (slack v/s disqus)
- Analytics stuff
- Image compression (because terrible football analyses was very heavy)
Ask Aayush
- Adobe premium pro (aayu would see plans /feasibility e.t.c)
- Elastic search/Algolia
- Check other blogs for fitness, their layout e.t.c
Building portfolio
1. Install node.js
Install instructions
Download from: Link
2. Install Git SCM
Install instructions
Download from: Link
3. Clone the Git repo
- Open a terminal in the folder where you want to clone the repo
- Run the following command
git clone https://github.com/Nishkalkashyap/portfolio.git
4. Change the terminal directory
Run the following command
cd portfolio
5. Install project
Run the following command
npm install
6. Start the local server to begin editing the project
- Run the following command
npm run start
- Open your web-browser and type
http://localhost
to see the website.
7. Start editing file
- Open the file in local directory
/.vuepress/components/Resume.vue
- Edit the file and save the changes
- Observe the changes in the website
Using ffmpeg.
#video## scaling
ffmpeg -i 'input.mp4' -vf "scale=1920:-1" './output.mp4'
#changing## bitrate
ffmpeg -i 'input.mp4' -b:v "1000K" './output.mp4'
#bitrate## alternative (crf may vary from 18-24 i.e. high quality to low quality);
ffmpeg -i 'input.mp4' -vcodec libx264 -crf 24 './output.mp4'
#video## speed (take note of -an flag. Removed audio)
ffmpeg -i 'input.mp4' -vf "setpts=0.5*PTS" -an './output.mp4'
#framerate## ffmpeg -i 'input.mp4' -r 24 -an './output.mp4'
#screenshot## ffmpeg -i 'input.mp4' -ss 01:23:45 -vframes 1 './output.jpg'
#override:## take note of -y flag
ffmpeg -y -i 'input.mp4' './output.mp4'
#chaining## commands - use ';' in powershell and '&&' in bash
ffmpeg -f concat -i files.txt -an -codec copy output1.mov;ffmpeg -i output1.mov -vf "setpts=0.5*PTS,scale=800:-1" -b:v "1000K" output2.mov
#video## concat
### ref: https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg#11175851## cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
ffmpeg -f concat -i mylist.txt -c copy output.mp4
Quark news mentions
Setting up a VPN Server.
- Follow the guide here
- Do not waste time setting up open VPN.
Firebase functions:config:set
Note
View on firebase: Link
1. To set environment variables
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"
2. To get environment variables
firebase functions:config:get someservice
- which returns
{
"someservice": {
"key":"THE API KEY",
"id":"THE CLIENT ID"
}
}
OpenSSL encrypt/decrypt files.
Note
View on stackoverflow: Link
1. To encrypt
openssl enc -aes-256-cbc -in un_encrypted.data -out encrypted.data
2. To decrypt
//with password prompt
openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data
//without password prompt
openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data -k [MyPassword]
e.g. openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data -k 123456789
Travis encrypt files
Note
View on travis: Link
1. Encrypting a single file
### use --add flag to automatically add decrypt script to .travis.yml.
travis encrypt-file inputFilePath outputFilePath --add
2. Encrypting multiple files
- Adding files to a tar archive.
### Where foo and bar are the files you want to encrypt.
tar cvf secrets.tar foo bar
travis encrypt-file secrets.tar --add
- Extracting the tar archive
//-C is for CWD
- tar xvf secrets.tar -C ./out-dir
Appvoyer encrypt files
Note
View on appvoyer: Link
1. Encrypting file on development machine
- Download
secure-file
utility by running the following command on development machine:
### on windows
iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))
### on linux
curl -sflL 'https://raw.githubusercontent.com/appveyor/secure-file/master/install.sh' | bash -e -
- To encrypt a file:
### on windows
appveyor-tools\secure-file -encrypt C:\path-to\filename-to-encrypt.ext -secret MYSECRET1234
### on linux
./appveyor-tools/secure-file -encrypt /path-to/filename-to-encrypt.ext -secret MYSECRET1234
Encrypted file will be saved in the same directory as the input file, but with the .enc
extension added. You can optionally specify output file name with the -out
parameter.
2. Decrypting files during an AppVeyor build
- Put the “secret” value to the project environment variables on the Environment tab of the project settings or in the
appveyor.yml
as a secure variable:
environment:
my_secret:
secure: BSNfEghh/l4KAC3jAcwAjgTibl6UHcZ08ppSFBieQ8E=
- To decrypt the file, add these lines to the
install
section of your project config:
install:
- ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))
- cmd: appveyor-tools\secure-file -decrypt path-to\encrypted-filename.ext.enc -secret %my_secret%
- sh: ./appveyor-tools/secure-file -decrypt path-to/encrypted-filename.ext.enc -secret $my_secret
The line starting with cmd:
will run on Windows-based images only and the line starting with sh:
on Linux.
Note
Note that file won’t be decrypted on Pull Request builds as secure variables are not set during PR build.
Setup travis
Note
View travis-ci official deployment guide: Link
1. Generate firebase token.
### This generates a token, e.g. "1/AD7sdasdasdKJA824OvEFc1c89Xz2ilBlaBlaBla"
firebase login:ci
### Encrypt this token
travis encrypt "1/AD7sdasdasdKJA824OvEFc1c89Xz2ilBlaBlaBla" --add
### This command may generate a warning ("If you tried to pass the name of the repository as the first argument, you probably won't get the results you wanted"). You can ignore it.
here
2. Copy base .travis.yml fron3. Push code to github.
Setup travis
1. Add a personal access token on github.
2. Make sure to have required "homepage" field in package.json.
e.g.
{
...
"homepage": "https://nishkalkashyap.github.io/notes",
}
3. Enable build on travis-ci, and add personal access token in environment variables.
here
4. Copy base .travis.yml fron5. Add A records of custom domain like so.
Type | Name | Value |
---|---|---|
A | [domain] | 185.199.108.153 |
A | [domain] | 185.199.109.153 |
A | [domain] | 185.199.110.153 |
A | [domain] | 185.199.111.153 |
Warning
If using a subdomain. Instead of adding A records, add a single CNAME record. e.g.
Type | Name | Value |
---|---|---|
CNAME | [subdomain] | [github-user-name].github.io |
Setup cloud build
Note
View on fireship: Link
Build Page
1. Goto2. Go to triggers in the sidebar and select trigger.
3. Setup local dev environment.
Add the .env file with all the environment variables.
Get the Keys from google-cloud-iam.
Run the following command.
gcloud kms encrypt --plaintext-file=.env --ciphertext-file=.env.enc --location=global --keyring=cloud-build-keyring --key=cloud-build-key
- Add the
cloudbuild.yaml
file at the root of your project. Copy the config file reference fron here. - Push to the repo.