https://www.gutenberg.org/help/mirroring.html
rsync -av --del aleph.gutenberg.org::gutenberg-epub .
Alternative : download in .zim format
https://www.gutenberg.org/help/mirroring.html
rsync -av --del aleph.gutenberg.org::gutenberg-epub .
Alternative : download in .zim format
iPad_10.2_2020_17.4.1_21E237_Restore.ipsw
file that you downloaded.iPhone IPSW: https://www.iclarified.com/750/where-to-download-iphone-firmware-files-from
# npm create svelte@latest .
> skeleton project
Install Tailwind CSS
# npm install -D tailwindcss postcss autoprefixer
# npx tailwindcss init -p
# vim svelte.config.js
# vim tailwind.config.js
# vim ./src/app.css
# vim ./src/routes/+layout.svelte
Add code in svelte.config.js
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
const config = {
kit: {
adapter: adapter()
},
preprocess: vitePreprocess()
};
export default config;
Edit file: tailwind.config.js
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {}
},
plugins: []
};
Modify file ./src/app.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Add Tailwind in +layout.svelte
<script>
import "../app.css";
</script>
<slot />
Sample +page.svelte code
<div class="text-3xl w-[300px] text-gray-600 bg-white p-10 mx-auto mt-10 shadow-lg rounded text-center">
Coming soon!
</div>
<style lang="postcss">:global(html) { background-color: theme(colors.gray.300) }</style>
Push to git (optional)
# git init && git add -A && git commit -m "Initial commit"
# git branch -M master
# git remote add origin [email protected]:project/gitname.git
# git push -u origin master
add_action('template_redirect', 'redirect_old_domain');
function redirect_old_domain() {
$old_domain = 'domain.org';
$new_domain = 'domain.com';
if ($_SERVER['HTTP_HOST'] == $old_domain && $request_uri == '/') {
// Redirect to the new domain without any path
$redirect_url = 'https://' . $new_domain;
wp_redirect($redirect_url, 302); // 302: Temporary redirect
exit;
}
// Check if the request is for a specific year
preg_match('/\/(\d{4})\//', $request_uri, $matches);
$year = isset($matches[1]) ? $matches[1] : '';
if ($year) {
// Redirect to the same URI on the new domain
$redirect_url = 'https://' . $new_domain . '/' . $year . $request_uri;
wp_redirect($redirect_url, 302); // 302: Temporary redirect
exit;
}
}
console.log('Loading function');
export const handler = async (event, context) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
console.log('value1 =', event.key1);
console.log('value2 =', event.key2);
console.log('value3 =', event.key3);
return { message: "hello world", post_body:JSON.stringify(event.body), event: JSON.stringify(event) };
};
NodeJS Build
npm i -D @sveltejs/adapter-node
File: svelte.config.js
import adapter from '@sveltejs/adapter-node';
ecosystem.config.cjs
module.exports = {
apps: [
{
name: 'name_app',
script: './build/index.js',
watch: false,
// ignore_watch: ['database'],
autorestart: true,
env: {
PORT: 3000,
ENV_PATH: "./.env.local",
}
}
]
};
cd "/var/www/domain.com/www/source"
git reset --hard
git pull
npm i
npm run build
pm2 reload "project_name"
Compatible with Node v21.6.1 (web52)
{
"name": "something project name",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p 3000",
"lint": "next lint"
},
"dependencies": {
"autoprefixer": "10.4.16",
"axios": "^1.6.2",
"dayjs": "^1.11.10",
"get-youtube-id": "^1.0.1",
"googleapis": "^128.0.0",
"md5": "^2.3.0",
"nanoid": "^5.0.3",
"next": "14.0.2",
"next-auth": "^4.24.5",
"nookies": "^2.5.2",
"postcss": "8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.12.0",
"react-lottie": "^1.2.3",
"react-simple-snackbar": "^1.1.11",
"react-youtube": "^10.1.0",
"sweetalert2": "^11.10.0",
"tailwindcss": "3.3.5",
"ua-parser-js": "^1.0.37",
"youtube-player": "^5.6.0"
},
"devDependencies": {
"autoprefixer": "^10.0.1",
"postcss": "^8",
"tailwindcss": "^3.3.0"
}
}
Backup to folder "databasename-DATE"
mongodump --db databasename --out databasename-$(date +'%m-%d-%y')
Restore
mongorestore --db databasename --drop databasename-DATE/databasename
mongorestore --db databasename databasename-DATE/databasename
--drop : we’ll make sure that the target database is first dropped so that the backup is restored in a clean database
Install
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Run
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Use it
nvm use 14
nvm install 14
nvm list
Check what version available online
nvm ls-remote
Create a new repository on the command line
echo "# browser-beauty" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin [email protected]:aizuikmal/browser-beauty.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin [email protected]:aizuikmal/browser-beauty.git
git branch -M master
git push -u origin master
On Linux server
Run:
ssh-keygen -t ed25519 -a 200 -C "[email protected]"
cat id_ed25519.pub >> authorized_keys
Now, copy the content of .ssh/ed25519 file into GitHub Action secret variable. (Repo > Settings > Secret & Variables > Actions > New Repository Secret)
The copied content of .ssh/ed25519 file has to start from:
-----BEGIN PRIVATE KEY-----
...... key ......
-----END PRIVATE KEY-----
Suggestion name : REMOTE_PRIVATE_KEY
Create 2 more keys & value for;
So, you will have 3 secrets.
Now, create a folder & YAML file in the repo.
File: .github/workflows/ssh-remote-execution.yml
name: Remote SSH Command
on:
push:
branches:
- master
jobs:
execute-remote-script:
runs-on: ubuntu-latest
steps:
- name: Execute script on remote server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
script: |
cd /var/www/app_location/www/source
git reset --hard
git pull
npm i
npm run build
pm2 restart app_name
Then, commit to branch master
.
File: _app.js
import Script from "next/script";
import Head from "next/head"
const GA_MEASUREMENT_ID = 'G-XXXXXXXX'
<Head>
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`}
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_MEASUREMENT_ID}');
`}
</Script>
</Head>
Ref: https://hackernoon.com/setting-up-google-analytics-4-in-a-nextjs-project
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"/>
Some reference for wp-config.php
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['HTTPS'] = 'on';
$_SERVER['HTTP_HOST'] = 'domain.com';
define('FORCE_SSL_ADMIN', true);
define('DISALLOW_FILE_EDIT', true);
define('WP_HOME','https://domain.com');
define('WP_SITEURL','https://domain.com');
define('FS_METHOD','direct');
/.vscode/settings.json
{
"editor.formatOnSave": false,
"prettier.singleQuote": true,
"prettier.jsxSingleQuote": true,
"prettier.tabWidth": 2,
"prettier.useTabs": true,
"editor.tabSize": 2,
"prettier.singleAttributePerLine": true,
"prettier.printWidth": 10000,
"printWidth": 1000,
"prettier.semi": false,
"svelte.plugin.svelte.compilerWarnings": {
"a11y-click-events-have-key-events": "ignore",
"a11y-no-static-element-interactions": "ignore"
},
"explorer.compactFolders": false
}
Add prettier ignore on the file
JS
// prettier-ignore
HTML
<!-- prettier-ignore -->
CSS
/* prettier-ignore */
# apt install certbot python3-certbot-nginx
# certbot --nginx -d example.com -d www.example.com
Certbot will modify nginx /site-available/default file, and append the 443 entry.
It also will install certbot's service for auto renew.
# systemctl status certbot.timer
To test the auto-renew.
certbot renew --dry-run
server {
listen 80;
#server_name ~^ (?<subdomain>.+)\.domain\.com$;
server_name "~^(?<subdomain>[a-z0-9]{32}+)\.domain\.com$";
# server_name "~^(www.)?ucwebapi(-uccore)?(\d{1,3}-\d{1,3})?\.domain\.com";
root /var/www/symfny.io/public_frontend/src/out;
index index.html;
}