Skip to content

Instantly share code, notes, and snippets.

const path = require('path')
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const mongodb = require('mongodb').MongoClient
// MongoDB Snippet
const mongodbUrl = 'mongodb://localhost:27017' // Local MongoDB Server Address
mongodb.connect(mongodbUrl, function(err, client) { // Connect to local MongoDB Server
@dragonman225
dragonman225 / typora-installer.sh
Last active March 7, 2023 01:41
Typora Install Script for Linux
#!/bin/bash
# Typora Installer by dragonman225
# Variables
USER=$(/usr/bin/id -run)
INSTALL_DIR="${HOME}/applications"
APP_SHORTCUT="/usr/share/applications/typora.desktop"
TYPORA_ARCHIVE="/tmp/Typora-linux-x64.tar.gz"
# Greeting
@dragonman225
dragonman225 / svp4-preinstaller.sh
Last active August 12, 2018 13:19
Install SVP4 Dependencies on Arch Linux
# SVP4 Install for Arch
# Dependencies
sudo pacman -S vulkan-headers mediainfo-gui lsof vapoursynth qt5-declarative
@dragonman225
dragonman225 / start-chrm.sh
Last active November 19, 2019 17:06
Start Chromium / Chrome with a new, clean profile independent of the default one.
#!/bin/bash
EXT_BROWSERPLUS="/mnt/data/Sync/Web/Projects/BrowserPlus"
SESSION_DIR="${HOME}/Downloads/chrm-session"
if [ -z "$1" ] || [ -z "$2" ];
then
echo "Usage: start-chrm.sh {URL} {Session_Name}"
else
OPT_EXT="--load-extension=${EXT_BROWSERPLUS}"
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Node.js
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
@dragonman225
dragonman225 / upgrade-deps.js
Last active January 7, 2020 15:33
Upgrade dependencies to the latest with yarn.
/**
* Upgrade dependencies to the latest with pnpm.
*/
const { spawn } = require('child_process')
const manifest = require('../package.json')
const devDeps = Object.keys(manifest.devDependencies
? manifest.devDependencies : [])
@dragonman225
dragonman225 / diskoff.sh
Last active January 9, 2020 23:57
Turn off disks on Linux.
#!/bin/bash
lsblk
echo -e "Proceed to stop sda, sdc, sdd ? (y/n)"
read -p "> " answer
if [ $answer = "y" ]; then
echo 1 > /sys/block/sda/device/delete
echo 1 > /sys/block/sdc/device/delete
echo 1 > /sys/block/sdd/device/delete
@dragonman225
dragonman225 / diskon.sh
Created November 19, 2019 16:46
Turn on disks on Linux.
#!/bin/bash
for i in $(seq 1 5);
do
echo "Scan host${i}"
echo "- - -" > /sys/class/scsi_host/host${i}/scan
done
@dragonman225
dragonman225 / dtswav2flac.sh
Created November 19, 2019 16:48
Convert all DTS-WAV files in a folder to multi-channel FLAC files.
#!/bin/bash
for file in *.wav;
do name=$(echo $file | sed "s/\\.wav//g");
ffmpeg -acodec dts -i "$name".wav -vn -sn -acodec flac "$name".flac;
done