initial
This commit is contained in:
commit
74ae93a96e
734 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,97 @@
|
|||
# Basics
|
||||
|
||||
- URL
|
||||
|
||||
|
||||
Source: [https://www.youtube.com/watch?v=AlkDbnbv7dk](https://www.youtube.com/watch?v=AlkDbnbv7dk)
|
||||
|
||||

|
||||
|
||||
Path is like folder and resource is like a file
|
||||
|
||||
IP address: **IP addresses enable websites, servers, and devices**
|
||||
to send and receive data from one another
|
||||
|
||||
- IP and mac
|
||||
|
||||
[https://superuser.com/questions/802421/can-a-website-see-know-my-mac-address-even-if-i-use-a-vpn](https://superuser.com/questions/802421/can-a-website-see-know-my-mac-address-even-if-i-use-a-vpn)
|
||||
|
||||
- OSI
|
||||
|
||||
|
||||
[https://www.youtube.com/watch?v=LANW3m7UgWs](https://www.youtube.com/watch?v=LANW3m7UgWs)
|
||||
|
||||

|
||||
|
||||
# **The OSI model explained in simple terms**
|
||||
|
||||

|
||||
|
||||
[Tom Nagle](https://tomanagle.medium.com/?source=post_page-----2abc3c7adadc--------------------------------)
|
||||
|
||||
·
|
||||
|
||||
Follow
|
||||
|
||||
4 min read
|
||||
|
||||
·
|
||||
|
||||
Jan 19, 2014
|
||||
|
||||
213
|
||||
|
||||
2
|
||||
|
||||
The Open System Interconnection model (OSI) is a seven layer model used to visualize computer networks. The OSI model is often viewed as complicated and many fear having to learn the model. However, the OSI model is an extremely useful tool for development and problem solving. Each of the seven layers goes up in increments of one as it gets closer to the human user. Layer one — the application layer, is closest to the person while layer seven — the physical layer is where the network receives and transmits raw data. The OSI model belongs to the International Organization for Standards (ISO) and is maintained by the identification ISO/IEC 7498–1. In this post, each of the seven layers of the OSI model will be explained in simple terms. The layers will be explained from layer seven to layer one, as this is where the data flow starts.
|
||||
|
||||

|
||||
|
||||
# **The seven layers of the OSI model**
|
||||
|
||||
# **Layer 7 — Application**
|
||||
|
||||
The application layer is where the user inputs data and data is output to the user. The application layer is usually software that is run off the local machine, however this depends on the network architecture. The software could be cloud based, meaning it runs off a server in a remote location and data is transferred over the internet, or the software could be run on a local server. The application layer provides services for email, Telnet and file Transfer for example. An example of the application layer is an internet browser, an FTP client or even Microsoft Word.
|
||||
|
||||
# **Layer 6 — Presentation**
|
||||
|
||||
The presentation layer is where the operating system lies. This operating system could be Windows, OS X, a Unix based operating system or one of the many others available. Where the human user interacts with the application layer described above, the application layer interacts with the presentation layer. This may be done directly, or through a runtime environment such as the Java Runtime Environment (JRE).
|
||||
|
||||
# **Layer 5 — Session**
|
||||
|
||||
The session layer is responsible for creating and maintaining sessions between the operating system on the presentation layer and other, third party machines. For example, when a user is browsing the internet, they are interacting with the application layer, the application layer is interacting with the presentation layer and the session layer allows the operating system to interact with the web server.
|
||||
|
||||
# **Layer 4 — Transport**
|
||||
|
||||
The transport layer is responsible for the logistics of the session. In the example used above, the transport layer would be responsible for determining what and how much information is transferred between the operating system and the web server.
|
||||
|
||||
# **Layer 3 — Network**
|
||||
|
||||
The network layer is where routers operate. A router is a hardware device that forwards packets of information between computers on a network. This is where your IP address comes from and in the example used above, the router is responsible for sending packets of information out into the internet and receiving them. These packets origin and destination is determined by the IP address of your router.
|
||||
|
||||
# **Layer 2 — Data link**
|
||||
|
||||
The data link layer is where switches operate and provides a reliable link between two directly connected nodes. The data link layer is also responsible for detecting and possibly fixing any packet errors that may form on the physical layer. The data link layer is divided into two separate layers, the Media Access Control (MAC) and Logical Link Control (LLC) layers. The MAC layer is responsible for controlling how devices connected to the network gain access. The LLC layer controls error checking, possible fixes and packet synchronization.
|
||||
|
||||
# **Layer 1 — Physical**
|
||||
|
||||
The physical layer is literally the physical hardware that makes up the network. This layer has several major functions:
|
||||
|
||||
- Defining physical specifications
|
||||
- Defining protocols
|
||||
- Defining transmission mode (half duplex & full duplex)
|
||||
- Defining the network’s topology
|
||||
|
||||
Hardware such as the physical components of Ethernet cables and Bluetooth are just some examples of the physical layer.
|
||||
|
||||
# **Purpose of the OSI Model**
|
||||
|
||||
Even after reading a description of each of the seven layers, you may still be confused as to how the OSI model applies to real life networking. It’s commonly misunderstood how a model can be used to solve real-life problems and in some cases, a model may not be the best approach. However, in many aspects of Information & Communications Technology(ICT), a model can be extremely useful and that is the case for the OSI model.
|
||||
|
||||
When first discovering a networking problem, it can be confusing as to where you should start. The OSI model helps you to start figuring out where the problem may reside and therefore, help you to solve the problem. For example, a client’s computer is not able to reach a website. The problem is isolated to one device on the network, so it can be assumed that the problem is likely to be on the application layer. However, after testing you find that the problem still exists when you try a different web browser and so the application layer is ruled out. You then assume that the problem resides on the presentation layer and start looking for faulty settings. After some digging around you find that your client has entered some DNS settings incorrectly and so you then conclude the problem is on the presentation layer.
|
||||
|
||||
You may already be using the OSI model for simple problem solving such as the example above without even realizing it. However, when dealing with large, corporate scale networking a purposeful use of the OSI model can make your job much easier and more enjoyable.
|
||||
|
||||
- socket
|
||||
|
||||

|
||||
|
|
@ -0,0 +1,456 @@
|
|||
# CSS
|
||||
|
||||
- Sass handwritten
|
||||
|
||||
[sass.pdf](../../_resources/sass.pdf)
|
||||
|
||||
[sass.pdf](../../_resources/sass%201.pdf)
|
||||
|
||||
- nth-child pseudoclass
|
||||
|
||||
To select the list for specific number.
|
||||
For eg:
|
||||
|
||||
```html
|
||||
<ul >
|
||||
<li>ty</li>
|
||||
<li>rt</li>
|
||||
<li >as</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
```css
|
||||
ul li:nth-child(2){
|
||||
color: red;
|
||||
}
|
||||
```
|
||||
|
||||
instead of 2, odd or even can be used too.
|
||||
|
||||
Output:
|
||||
|
||||

|
||||
|
||||
also formula can be used like
|
||||
|
||||
```css
|
||||
ul li:nth-child(4n+0){
|
||||
color: red;
|
||||
}
|
||||
```
|
||||
|
||||
all multiples of 4 is selected
|
||||
|
||||
- Caution while using flex
|
||||
|
||||
When using flex layout, for eg to adjust div at center both horizontally and vertically. When we decrease height then upper portion gets out of screen too. To avoid this: set margin as auto for that div.
|
||||
|
||||
```css
|
||||
html,
|
||||
body,
|
||||
#root,
|
||||
.App {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.App {
|
||||
font-family: "Poppins", sans-serif;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.calcBox {
|
||||
margin: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
width: 350px;
|
||||
grid-gap: 1rem;
|
||||
padding: 1rem;
|
||||
background-color: #696969;
|
||||
border: 2px solid black;
|
||||
border-radius: 2px;
|
||||
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<div className="App">
|
||||
<div className="calcBox">
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
- Some important snippets
|
||||
|
||||
minmax application:
|
||||
|
||||
```scss
|
||||
/* Use of minmax */
|
||||
.List {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(100px, 1fr) minmax(200px, 3fr) minmax(
|
||||
150px,
|
||||
2fr
|
||||
) minmax(100px, 1fr) minmax(100px, 1fr) minmax(200px, 3fr);
|
||||
}
|
||||
```
|
||||
|
||||
- For inputButton properly implemented:
|
||||
|
||||
```html
|
||||
<div className="Playlist">
|
||||
<div className="playlistInput">
|
||||
<input
|
||||
className="inputLink"
|
||||
type="text"
|
||||
placeholder="Insert the url of youtube playlist"
|
||||
/>
|
||||
<button>Generate Link</button>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
```css
|
||||
:root {
|
||||
--deeppink: rgb(255, 0, 104);
|
||||
--deeppinkDark: rgb(230, 0, 94);
|
||||
}
|
||||
|
||||
.Playlist {
|
||||
margin-top: 5rem;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.Playlist .playlistInput {
|
||||
width: 50%;
|
||||
min-width: 300px;
|
||||
border: 4px solid var(--deeppink);
|
||||
border-radius: 3px;
|
||||
overflow-y: hidden;
|
||||
/* padding: 0.5rem; */
|
||||
}
|
||||
|
||||
.playlistInput input {
|
||||
width: 80%;
|
||||
/* height: 100%; */
|
||||
height: 2rem;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.playlistInput button {
|
||||
width: 20%;
|
||||
height: 3rem;
|
||||
background-color: var(--deeppink);
|
||||
color: white;
|
||||
border: none;
|
||||
/* box-sizing: border-box; */
|
||||
cursor: pointer;
|
||||
transition: all 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
.playlistInput button:hover {
|
||||
background-color: var(--deeppinkDark);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
- Spinner
|
||||
|
||||
```jsx
|
||||
import "./Spinner.css";
|
||||
|
||||
// use 'npm i react-loader-spinner@4.0.0
|
||||
import Loader from "react-loader-spinner";
|
||||
|
||||
// expected props:
|
||||
// visible: boolean ,
|
||||
// classes: string,
|
||||
// color: string,
|
||||
// text: string
|
||||
// https://mhnpd.github.io/react-loader-spinner/docs/category/components/
|
||||
/* text : Radio,Audio,Ball Triangle,Bars,Blocks,Circles With Bar,Circles,Color Ring,Comment,Discuss,
|
||||
DNA,Falling Lines,Fidget Spinner,Grid,Hearts,Hourglass,
|
||||
Infinity Spin,LineWave,MagnifyingGlass,Mutating Dots,Oval,Progress Bar,Puff,
|
||||
RevolvingDot,Rings,Rotating Lines,Rotating Square,
|
||||
Rotating Triangles,Tail Spin,Three Circles,Three Dots,Triangle, Vortex
|
||||
, Watch*/
|
||||
function Spinner(props) {
|
||||
const { visible, text, type } = props;
|
||||
let classes = props.classes || "";
|
||||
const color = props.color || "#fff";
|
||||
let color1 = props.color;
|
||||
// console.log("is spinner visible: ", visible);
|
||||
return (
|
||||
<div className={`Spinner ${classes} ${visible ? "" : "none"}`}>
|
||||
<Loader
|
||||
type={type}
|
||||
color={color}
|
||||
height={50}
|
||||
width={50}
|
||||
timeout={0} //30 secs
|
||||
/>
|
||||
<span style={color1 ? { color: color } : {}} class="Loading_Text">
|
||||
{text}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Spinner;
|
||||
```
|
||||
|
||||
```css
|
||||
.none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.Spinner .Loading_Text {
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
```
|
||||
|
||||
other way
|
||||
```js
|
||||
import "./Spinner.scss";
|
||||
|
||||
function Spinner(props) {
|
||||
const { visible, text, type } = props;
|
||||
let classes = props.classes || "";
|
||||
const color = props.color || "#fff";
|
||||
let color1 = props.color;
|
||||
// console.log("is spinner visible: ", visible);
|
||||
return (
|
||||
// <div className={`Spinner ${classes} ${visible ? "" : "none"}`}>
|
||||
<div className={`spinnerStyle ${classes} ${visible ? "" : "none"}`}>
|
||||
<div className="spinner"></div>
|
||||
<span style={color1 ? { color: color } : {}} class="Loading_Text">
|
||||
{text}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Spinner;
|
||||
|
||||
```
|
||||
|
||||
Spinner.scss
|
||||
```scss
|
||||
.none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.spinner .Loading_Text {
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
border: 8px solid #f3f3f3;
|
||||
border-top: 8px solid #000000;
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.spinnerStyle {
|
||||
display: "flex";
|
||||
justify-content: "center";
|
||||
align-items: "center";
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
- Creating pill shaped button
|
||||
|
||||
```css
|
||||
.proceed {
|
||||
margin-top: 1rem;
|
||||
color: white;
|
||||
background-color: black;
|
||||
border: none;
|
||||
border-radius: 9999px;
|
||||
padding: 1rem 0.5rem
|
||||
}
|
||||
```
|
||||
|
||||
set border radius as very long size
|
||||
|
||||
Output:
|
||||
|
||||

|
||||
|
||||
- scroll to specific position with anchor tag
|
||||
|
||||
|
||||
- aspect-ratio
|
||||
|
||||

|
||||
|
||||
- whitespace property
|
||||
|
||||

|
||||
|
||||
- calc()
|
||||
|
||||
## CSS only Approach (If height is known/fixed)
|
||||
|
||||
When you want the middle element to span across entire page vertically, you can use `[calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc)` which is introduced in CSS3.
|
||||
|
||||
Assuming we have a *fixed height* `header` and `footer` elements and we want the `section` tag to take entire available vertical height...
|
||||
|
||||
**[Demo](http://jsfiddle.net/WdrDH/)**
|
||||
|
||||
**Assumed markup** and your CSS should be
|
||||
|
||||
```css
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
header {
|
||||
height: 100px;
|
||||
background: grey;
|
||||
}
|
||||
|
||||
section {
|
||||
height: calc(100% - (100px + 150px));
|
||||
/* Adding 100px of header and 150px of footer */
|
||||
background: tomato;
|
||||
}
|
||||
|
||||
footer {
|
||||
height: 150px;
|
||||
background-color: blue;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<header>100px</header>
|
||||
<section>Expand me for remaining space</section>
|
||||
<footer>150px</footer>
|
||||
```
|
||||
|
||||
- centralising div
|
||||
|
||||

|
||||
|
||||
Ref:
|
||||
|
||||
[https://www.youtube.com/watch?v=HOM47v73yG8&list=PLBOEc6PNYgCQZl3gDUDtv034yz-kwWkFo&index=3&t=200s](https://www.youtube.com/watch?v=HOM47v73yG8&list=PLBOEc6PNYgCQZl3gDUDtv034yz-kwWkFo&index=3&t=200s)
|
||||
|
||||
[https://www.youtube.com/watch?v=HOM47v73yG8&list=PLBOEc6PNYgCQZl3gDUDtv034yz-kwWkFo&index=3&t=200s](https://www.youtube.com/watch?v=HOM47v73yG8&list=PLBOEc6PNYgCQZl3gDUDtv034yz-kwWkFo&index=3&t=200s)
|
||||
|
||||
when using this method to centralize div, when we decrease screen height then div can go out of screen. To prevent this, use position absolute and
|
||||
|
||||
- For setting dark theme
|
||||
|
||||
We need to invert all colors of the page.
|
||||
|
||||
```html
|
||||
<div style='background-color: white'>
|
||||
hello
|
||||
</div
|
||||
```
|
||||
|
||||
```jsx
|
||||
const css = `html {
|
||||
-webkit-filter: invert(100%);
|
||||
-moz-filter: invert(100%);
|
||||
-o-filter: invert(100%);
|
||||
-ms-filter: invert(100%);
|
||||
}`
|
||||
const head = document.head
|
||||
const style = document.createElement('style')
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
head.appendChild(style);
|
||||
```
|
||||
|
||||
[https://thewebdev.info/2021/08/14/how-to-invert-color-on-all-elements-of-a-page-with-javascript/#:~:text=Page with JavaScript-,To invert color on all elements of a page with,100%25](https://thewebdev.info/2021/08/14/how-to-invert-color-on-all-elements-of-a-page-with-javascript/#:~:text=Page%20with%20JavaScript-,To%20invert%20color%20on%20all%20elements%20of%20a%20page%20with,100%25))%20value%20with%20CSS.&text=Then%20we%20can%20invert%20all,%25)%3B%20%7D%60%20const%20head%20%3D%20document.
|
||||
|
||||
- Custom input type=file
|
||||
|
||||
[https://dev.to/faddalibrahim/how-to-create-a-custom-file-upload-button-using-html-css-and-javascript-1c03](https://dev.to/faddalibrahim/how-to-create-a-custom-file-upload-button-using-html-css-and-javascript-1c03)
|
||||
|
||||
- background image
|
||||
|
||||
```jsx
|
||||
body{
|
||||
background-image: url("../images/back2.jpg");
|
||||
|
||||
/* Full height */
|
||||
height: 100%;
|
||||
|
||||
/* Center and scale the image nicely */
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
|
||||
margin-left: 0px;
|
||||
|
||||
/*scroll-behavior: smooth !important;*/
|
||||
/*margin-top: 0px;*/
|
||||
}
|
||||
```
|
||||
|
||||
- Useful properties
|
||||
|
||||
Reference: [https://www.youtube.com/watch?v=srzsj3xtHMM](https://www.youtube.com/watch?v=srzsj3xtHMM)
|
||||
|
||||
Clamp:
|
||||
|
||||
```css
|
||||
.container{
|
||||
min-width: 100px;
|
||||
width: 50%;
|
||||
max-width: 200px;
|
||||
}
|
||||
```
|
||||
|
||||
Above can be written as:
|
||||
|
||||
```css
|
||||
.container{
|
||||
width: clamp(100px, 50%, 200px);
|
||||
}
|
||||
```
|
||||
|
||||
Scroll snap:
|
||||
|
||||
while scrolling the current element will be aligned to center
|
||||
|
||||
```css
|
||||
.container{
|
||||
overflow: scroll;
|
||||
scroll-snap-type: x mandatory;
|
||||
}
|
||||
.container .child{
|
||||
scroll-snap-align: center;
|
||||
}
|
||||
```
|
||||
|
||||
order:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,3 @@
|
|||
# API
|
||||
|
||||
"genius-lyrics-api": "^3.0.6", react
|
||||
|
|
@ -0,0 +1 @@
|
|||
# Untitled
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# fileLu
|
||||
|
||||
```jsx
|
||||
const HOST='https://filelu.com/api'
|
||||
const FormData=require('form-data')
|
||||
fetch(`${HOST}/upload/server?key=${key}`)
|
||||
.then(res=>res.json())
|
||||
.then(data=>{
|
||||
const {sess_id,result}=data;
|
||||
const formdata=new FormData()
|
||||
formdata.append('sess_id',sess_id)
|
||||
formdata.append('utype','prem')
|
||||
formdata.append('file_0',file,'AliceinChainsThemBones2022Remaster.mp3')
|
||||
|
||||
fetch(result,{
|
||||
method: 'post',
|
||||
body: formdata
|
||||
})
|
||||
.then(res=>res.json())
|
||||
.then(console.log)
|
||||
.catch(console.log)
|
||||
})
|
||||
.catch(console.log )
|
||||
```
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,3 @@
|
|||
# macros
|
||||
|
||||
[https://www.autohotkey.com/boards/viewtopic.php?t=34355](https://www.autohotkey.com/boards/viewtopic.php?t=34355)
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
# youtube stream itags
|
||||
|
||||
YouTube video stream format codes itags
|
||||
|
||||
[Raw](https://gist.github.com/sidneys/7095afe4da4ae58694d128b1034e01e2/raw/9794b8b7237306d8f9efd8e83ccb08fc9e188432/youtube_format_code_itag_list.md)
|
||||
|
||||
**[youtube_format_code_itag_list.md](https://gist.github.com/sidneys/7095afe4da4ae58694d128b1034e01e2#file-youtube_format_code_itag_list-md)**
|
||||
|
||||
# YouTube video stream format codes
|
||||
|
||||
### Comprehensive list of YouTube format code itags
|
||||
|
||||
| itag Code | Container | Content | Resolution | Bitrate | Range | VR / 3D |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 5 | flv | audio/video | 240p | - | - | - |
|
||||
| 6 | flv | audio/video | 270p | - | - | - |
|
||||
| 17 | 3gp | audio/video | 144p | - | - | - |
|
||||
| 18 | mp4 | audio/video | 360p | - | - | - |
|
||||
| 22 | mp4 | audio/video | 720p | - | - | - |
|
||||
| 34 | flv | audio/video | 360p | - | - | - |
|
||||
| 35 | flv | audio/video | 480p | - | - | - |
|
||||
| 36 | 3gp | audio/video | 180p | - | - | - |
|
||||
| 37 | mp4 | audio/video | 1080p | - | - | - |
|
||||
| 38 | mp4 | audio/video | 3072p | - | - | - |
|
||||
| 43 | webm | audio/video | 360p | - | - | - |
|
||||
| 44 | webm | audio/video | 480p | - | - | - |
|
||||
| 45 | webm | audio/video | 720p | - | - | - |
|
||||
| 46 | webm | audio/video | 1080p | - | - | - |
|
||||
| 82 | mp4 | audio/video | 360p | - | - | 3D |
|
||||
| 83 | mp4 | audio/video | 480p | - | - | 3D |
|
||||
| 84 | mp4 | audio/video | 720p | - | - | 3D |
|
||||
| 85 | mp4 | audio/video | 1080p | - | - | 3D |
|
||||
| 92 | hls | audio/video | 240p | - | - | 3D |
|
||||
| 93 | hls | audio/video | 360p | - | - | 3D |
|
||||
| 94 | hls | audio/video | 480p | - | - | 3D |
|
||||
| 95 | hls | audio/video | 720p | - | - | 3D |
|
||||
| 96 | hls | audio/video | 1080p | - | - | - |
|
||||
| 100 | webm | audio/video | 360p | - | - | 3D |
|
||||
| 101 | webm | audio/video | 480p | - | - | 3D |
|
||||
| 102 | webm | audio/video | 720p | - | - | 3D |
|
||||
| 132 | hls | audio/video | 240p | - | - | |
|
||||
| 133 | mp4 | video | 240p | - | - | |
|
||||
| 134 | mp4 | video | 360p | - | - | |
|
||||
| 135 | mp4 | video | 480p | - | - | |
|
||||
| 136 | mp4 | video | 720p | - | - | |
|
||||
| 137 | mp4 | video | 1080p | - | - | |
|
||||
| 138 | mp4 | video | 2160p60 | - | - | |
|
||||
| 139 | m4a | audio | - | 48k | - | |
|
||||
| 140 | m4a | audio | - | 128k | - | |
|
||||
| 141 | m4a | audio | - | 256k | - | |
|
||||
| 151 | hls | audio/video | 72p | - | - | |
|
||||
| 160 | mp4 | video | 144p | - | - | |
|
||||
| 167 | webm | video | 360p | - | - | |
|
||||
| 168 | webm | video | 480p | - | - | |
|
||||
| 169 | webm | video | 1080p | - | - | |
|
||||
| 171 | webm | audio | - | 128k | - | |
|
||||
| 218 | webm | video | 480p | - | - | |
|
||||
| 219 | webm | video | 144p | - | - | |
|
||||
| 242 | webm | video | 240p | - | - | |
|
||||
| 243 | webm | video | 360p | - | - | |
|
||||
| 244 | webm | video | 480p | - | - | |
|
||||
| 245 | webm | video | 480p | - | - | |
|
||||
| 246 | webm | video | 480p | - | - | |
|
||||
| 247 | webm | video | 720p | - | - | |
|
||||
| 248 | webm | video | 1080p | - | - | |
|
||||
| 249 | webm | audio | - | 50k | - | |
|
||||
| 250 | webm | audio | - | 70k | - | |
|
||||
| 251 | webm | audio | - | 160k | - | |
|
||||
| 264 | mp4 | video | 1440p | - | - | |
|
||||
| 266 | mp4 | video | 2160p60 | - | - | |
|
||||
| 271 | webm | video | 1440p | - | - | |
|
||||
| 272 | webm | video | 4320p | - | - | |
|
||||
| 278 | webm | video | 144p | - | - | |
|
||||
| 298 | mp4 | video | 720p60 | - | - | |
|
||||
| 299 | mp4 | video | 1080p60 | - | - | |
|
||||
| 302 | webm | video | 720p60 | - | - | |
|
||||
| 303 | webm | video | 1080p60 | - | - | |
|
||||
| 308 | webm | video | 1440p60 | - | - | |
|
||||
| 313 | webm | video | 2160p | - | - | |
|
||||
| 315 | webm | video | 2160p60 | - | - | |
|
||||
| 330 | webm | video | 144p60 | - | hdr | |
|
||||
| 331 | webm | video | 240p60 | - | hdr | |
|
||||
| 332 | webm | video | 360p60 | - | hdr | |
|
||||
| 333 | webm | video | 480p60 | - | hdr | |
|
||||
| 334 | webm | video | 720p60 | - | hdr | |
|
||||
| 335 | webm | video | 1080p60 | - | hdr | |
|
||||
| 336 | webm | video | 1440p60 | - | hdr | |
|
||||
| 337 | webm | video | 2160p60 | - | hdr | |
|
||||
|
||||
```jsx
|
||||
//quality:itag
|
||||
const iTags = {
|
||||
144: "394", //videoonly: 394,132
|
||||
240: "395", //videoonly: 395,133
|
||||
|
||||
360: "18", //videoonly: 396,134 both: 18
|
||||
480: "44", //videoonly: 397, 135 both: 44
|
||||
720: "22", //videoonly: 398, 136 both: 22
|
||||
1080: "37", //videoOnly: 399, 137 both: 37
|
||||
1440: "264",
|
||||
2160: "138",
|
||||
};
|
||||
|
||||
// bitrate : itag
|
||||
const iTagAudio = {
|
||||
128: "140", //mp4
|
||||
64: "250", //webm
|
||||
160: "251", //webm
|
||||
48: "249", //webm
|
||||
};
|
||||
```
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# GitHub
|
||||
|
||||
[Managing Different Accounts](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/GitHub%20cc67e8c9e0c945a587b473d533a8d80a/Managing%20Different%20Accounts%200b4d3ba72da14c688ca2fc.md)
|
||||
|
||||
[Deploy react site](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/GitHub%20cc67e8c9e0c945a587b473d533a8d80a/Deploy%20react%20site%209aac11a6fab14d8b9165b5927bff7405.md)
|
||||
|
||||
[Git commands](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/GitHub%20cc67e8c9e0c945a587b473d533a8d80a/Git%20commands%206fce236e7a9646bdbbf63290300cf5b4.md)
|
||||
|
||||
[Setting multiple accounts](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/GitHub%20cc67e8c9e0c945a587b473d533a8d80a/Setting%20multiple%20accounts%20734586287c324b9e98996805.md)
|
||||
|
||||
[Project commit ids](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/GitHub%20cc67e8c9e0c945a587b473d533a8d80a/Project%20commit%20ids%206193aa70a9c64e9bb2e25c4e3003847.md)
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
# Deploy react site
|
||||
|
||||
- for vite use this
|
||||
https://dev.to/rashidshamloo/deploying-vite-react-app-to-github-pages-35hf
|
||||
|
||||
From site ‘[https://create-react-app.dev/docs/deployment/](https://create-react-app.dev/docs/deployment/)’
|
||||
|
||||
## [GitHub Pages](https://pages.github.com/)[](https://create-react-app.dev/docs/deployment/#github-pages)
|
||||
|
||||
> Note: this feature is available with react-scripts@0.2.0 and higher.
|
||||
>
|
||||
|
||||
### Step 1: Add `homepage` to `package.json`[](https://create-react-app.dev/docs/deployment/#step-1-add-homepage-to-packagejson)
|
||||
|
||||
**The step below is important!**
|
||||
|
||||
**If you skip it, your app will not deploy correctly.**
|
||||
|
||||
Open your `package.json` and add a `homepage` field for your project:
|
||||
|
||||
`"homepage": "https://myusername.github.io/my-app",`
|
||||
|
||||
or for a GitHub user page:
|
||||
|
||||
`"homepage": "https://myusername.github.io",`
|
||||
|
||||
or for a custom domain page:
|
||||
|
||||
`"homepage": "https://mywebsite.com",`
|
||||
|
||||
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
|
||||
|
||||
### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`[](https://create-react-app.dev/docs/deployment/#step-2-install-gh-pages-and-add-deploy-to-scripts-in-packagejson)
|
||||
|
||||
Now, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.
|
||||
|
||||
To publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:
|
||||
|
||||
`npm install --save gh-pages`Copy
|
||||
|
||||
Alternatively you may use `yarn`:
|
||||
|
||||
`yarn add gh-pages`Copy
|
||||
|
||||
Add the following scripts in your `package.json`:
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"predeploy": "npm run build",
|
||||
"deploy": "gh-pages -d build",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
```
|
||||
|
||||
The `predeploy` script will run automatically before `deploy` is run.
|
||||
|
||||
If you are deploying to a GitHub user page instead of a project page you'll need to make one additional modification:
|
||||
|
||||
1. Tweak your `package.json` scripts to push deployments to **master**:
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"predeploy": "npm run build",
|
||||
- "deploy": "gh-pages -d build",
|
||||
+ "deploy": "gh-pages -b master -d build",
|
||||
```
|
||||
|
||||
`"scripts": { "predeploy": "npm run build",- "deploy": "gh-pages -d build",+ "deploy": "gh-pages -b master -d build",`Copy
|
||||
|
||||
### Step 3: Deploy the site by running `npm run deploy`[](https://create-react-app.dev/docs/deployment/#step-3-deploy-the-site-by-running-npm-run-deploy)
|
||||
|
||||
Then run:
|
||||
|
||||
`npm run deploy`
|
||||
|
||||
### Step 4: For a project page, ensure your project’s settings use `gh-pages`[](https://create-react-app.dev/docs/deployment/#step-4-for-a-project-page-ensure-your-projects-settings-use-gh-pages)
|
||||
|
||||
Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:
|
||||
|
||||

|
||||
|
||||
### Step 5: Optionally, configure the domain[](https://create-react-app.dev/docs/deployment/#step-5-optionally-configure-the-domain)
|
||||
|
||||
You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.
|
||||
|
||||
Your CNAME file should look like this:
|
||||
|
||||
`mywebsite.com`
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
# Git commands
|
||||
|
||||
- Resetting local to specific commit
|
||||
|
||||
[https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit](https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit)
|
||||
|
||||
`git reset --hard <commidId> && git clean -f`
|
||||
|
||||
or a safer
|
||||
|
||||
`git clean -i`
|
||||
|
||||
commit id:
|
||||
|
||||

|
||||
|
||||
Use `git log` for commit id.
|
||||
|
||||
### Reverting Working Copy to Most Recent Commit
|
||||
|
||||
To revert to the previous commit, ignoring any changes:
|
||||
|
||||
```bash
|
||||
git reset --hard HEAD
|
||||
```
|
||||
|
||||
where HEAD is the last commit in your current branch
|
||||
|
||||
### Reverting The Working Copy to an Older Commit
|
||||
|
||||
To revert to a commit that's older than the most recent commit:
|
||||
|
||||
```bash
|
||||
# Resets index to former commit; replace '56e05fced' with your commit code
|
||||
git reset 56e05fced
|
||||
|
||||
# Moves pointer back to previous HEAD
|
||||
git reset --soft HEAD@{1}
|
||||
|
||||
git commit -m "Revert to 56e05fced"
|
||||
|
||||
# Updates working copy to reflect the new commit
|
||||
git reset --hard
|
||||
|
||||
# Push your changes to respective branch
|
||||
git push -f
|
||||
```
|
||||
|
||||
save modifications before resetting:
|
||||
|
||||
```bash
|
||||
# Alternatively, if there's work to keep:
|
||||
git stash
|
||||
git reset --hard 0d1d7fc32
|
||||
git stash pop
|
||||
# This saves the modifications, then reapplies that patch after resetting.
|
||||
# You could get merge conflicts, if you've modified things which were
|
||||
# changed since the commit you reset to.
|
||||
```
|
||||
|
||||
To revert changes after git push use revert instead of reset —hard
|
||||
|
||||
`git revert <commit_hash>`
|
||||
|
||||
or simply use below after using reset —hard
|
||||
|
||||
`git push -f origin main`
|
||||
|
||||
do not use —force, this will make all your coworkers hate you, use —force-with-lease, this will only allow you to push the code if there are no conflicting changes with the current parent branch
|
||||
|
||||
- Branches
|
||||
|
||||
[https://www.geeksforgeeks.org/how-to-set-upstream-branch-on-git/](https://www.geeksforgeeks.org/how-to-set-upstream-branch-on-git/)
|
||||
|
||||

|
||||
|
||||

|
||||
for adding remote url
|
||||
`git remote add <name> <url>`
|
||||
then
|
||||
`git push --set-upstream <name> master`
|
||||
PS C:\Users\harsh\Videos\imp\react\github\test1> `git branch main -u origin/main`
|
||||
Branch 'main' set up to track remote branch 'main' from 'origin'.*
|
||||
|
||||
*PS C:\Users\harsh\Videos\imp\react\github\test1> `git branch test -u origin/test`
|
||||
Branch 'test' set up to track remote branch 'test' from 'origin'.
|
||||
|
||||
`git push --set-upstream origin <branch name>`
|
||||
to show remote git details like url and all that
|
||||
`git remote show origin` or `git remote -v` (to see only url)
|
||||
To edit current url
|
||||
`git remote set-url origin git@bitbucket.org:tutorials/tutorials.git`
|
||||
|
||||
### **Merging other branch to main:**
|
||||
|
||||
Make sure first you update your **development** branch with master to resolve conflicts issue(if there are any):
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
git pull origin main
|
||||
git checkout development
|
||||
git merge main
|
||||
|
||||
```
|
||||
|
||||
Now see if master branch is merged without any conflict, if there's any conflict then you'll have to resolve them. Once you're done with that, you can:
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
git merge development
|
||||
git push origin main
|
||||
```
|
||||
|
||||
To copy content from A to B
|
||||
|
||||
`git checkout B`
|
||||
|
||||
`git merge A`
|
||||
|
||||
If A is test and B is main then
|
||||
|
||||
`git checkout main`
|
||||
|
||||
`git merge test`
|
||||
|
||||
To create a branch of specific commit:
|
||||
|
||||
`git checkout -b old_state <commit_hash>`
|
||||
|
||||
- Configuration
|
||||
|
||||
`git config —-global [user.name](http://user.name) 'moss'`
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Managing Different Accounts
|
||||
|
||||
|
||||
|
||||
Using more than 1 git account on same machine
|
||||
|
||||
### While cloning
|
||||
- git clone git@github.com-work
|
||||
Here `git@github.com-work` is ssh id
|
||||
|
||||
|
||||
So if username is a1 and a2 then
|
||||
|
||||
for a1:
|
||||
`git clone git@github.com:a1/code-repo.git`
|
||||
|
||||
for a2:
|
||||
`git clone git@github.com:a2/code-repo.git`
|
||||
|
||||
- To add new origin
|
||||
`git remote add origin git@github.com-work:a2/code-repo.git`
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Project commit ids
|
||||
|
||||
fixed scheduling of playlist : `32be0512c184d9d530efce99d1bc29aa4d38ab08`
|
||||
|
||||
latest commit for bull: `7fafc78a68c80629eed471b7590f3a540565478b`
|
||||
|
||||
removed job and using promises: `2c051842e47cfc5424a9e39b61a27671feb5087f`
|
||||
|
||||
latest after download/upload gofile: `b880014f924cd3147d3a0449eba2f1a7e1f8dc8d`
|
||||
|
||||
front end:
|
||||
|
||||
added scheduling: `c310df967e76bb9ca931f59a31fa714102922571`
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
# Setting multiple accounts
|
||||
|
||||
Source: [https://betterprogramming.pub/how-to-use-multiple-github-accounts-with-one-computer-c9ba3f851b75](https://betterprogramming.pub/how-to-use-multiple-github-accounts-with-one-computer-c9ba3f851b75)
|
||||
|
||||
For windows I use
|
||||
|
||||
```
|
||||
ssh-keygen -t rsa -C “your-email-address”
|
||||
```
|
||||
|
||||
- **t** stands for ‘**type**’ and **rsa** is type of encryption
|
||||
- **C** is for comment
|
||||
|
||||
3. The following will then show:
|
||||
|
||||
```
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (/c/Users/your_username/.ssh/id_rsa):
|
||||
```
|
||||
|
||||
Copy and paste the path followed by an **identifiable name** for the file:
|
||||
|
||||
```
|
||||
/c/Users/your_username/.ssh/id_rsa_IDENTIFIABLE_NAME_HERE
|
||||
```
|
||||
|
||||
I named my one test for the sake of this tutorial:
|
||||
|
||||
```
|
||||
/c/Users/your_username/.ssh/id_rsa_test
|
||||
```
|
||||
|
||||
**Make sure you don’t override id_rsa as this is your existing key for your original account.**
|
||||
|
||||
It will then ask you for the following:
|
||||
|
||||
```
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
```
|
||||
|
||||
Press ‘Enter’ twice to leave it blank.
|
||||
|
||||
You can now type in the following command to see all the SSH keys you have on your local machine:
|
||||
|
||||
```
|
||||
ls -al ~/.ssh
|
||||
```
|
||||
|
||||
- **ls** lists all the files in the current directory
|
||||
- **a** is for listing all files including hidden ones
|
||||
- **l** is for listing in a long format
|
||||
|
||||
You should then get something similar to this:
|
||||
|
||||
```
|
||||
total 46
|
||||
drwxr-xr-x 1 your_username 1049089 0 Jan 26 10:40 .
|
||||
drwxr-xr-x 1 your_username 1049089 0 Jan 23 12:12 ..
|
||||
-rw-r--r-- 1 your_username 1049089 3326 Nov 30 11:21 id_rsa
|
||||
-rw-r--r-- 1 your_username 1049089 748 Nov 30 11:21 id_rsa.pub
|
||||
-rw-r--r-- 1 your_username 1049089 1675 Jan 26 10:40 id_rsa_test
|
||||
-rw-r--r-- 1 your_username 1049089 399 Jan 26 10:40 id_rsa_test.pub
|
||||
-rw-r--r-- 1 your_username 1049089 803 Nov 30 12:08 known_hosts
|
||||
```
|
||||
|
||||
You should be able to see your new SSH key file. As you can see in my one I have both **id_rsa_test** and **id_rsa_test.pub**.
|
||||
|
||||
**id_rsa_test** is your private key stored on your machine, whilst **id_rsa_test.pub** is the public key which you will provide GitHub with.
|
||||
|
||||
Next you need to copy the **SSH key** which is stored in **id_rsa_test.pub** file. You can open this in text editor of your choice. I am currently using atom so I opened the file using the following command:
|
||||
|
||||
```
|
||||
atom ~/.ssh/id_rsa_test.pub
|
||||
```
|
||||
|
||||
You will then get something similar to this:
|
||||
|
||||
```
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEmSbc7ms4SNIf7G0e9EqdrQRTB17VFTqRtCbQ55sSc11xZP5B07UXf9+................a955cf1GUzsNIr60E7VuVxirrr+K2WcleqifnDEg1H/VbyJtEekh4Aav9csBwemTz3test@test.com
|
||||
```
|
||||
|
||||
The key is actually longer but I shortened it for the sake of this tutorial.
|
||||
|
||||
Copy this and navigate to your **GitHub account** → **Settings** → **SSH and GPG keys**
|
||||
|
||||

|
||||
|
||||
Click on **New SSH key**
|
||||
|
||||

|
||||
|
||||
Give your new key a title and then paste the **new generated SSH key** you copied before. ***It is a good idea to name your keys after the machine they’re from. As you can see I have three, Macbook, Windows and Cloud9 IDE***.
|
||||
|
||||
If you’re on a Mac you should be able to add this key on your terminal as well using the command below:
|
||||
|
||||
```
|
||||
ssh-add ~/.ssh/id_rsa_test
|
||||
```
|
||||
|
||||
For enabling ssh:
|
||||
|
||||
39
|
||||
|
||||
In Windows PowerShell (run as admin):
|
||||
|
||||
1. Check the current status of **ssh-agent**:
|
||||
|
||||
`Get-Service | ?{$_.Name -like '*ssh-agent*'} | select -Property Name, StartType, Status`
|
||||
|
||||
2. Enable the Service if it is disabled:
|
||||
|
||||
`Set-Service -Name ssh-agent -StartupType Manual`
|
||||
|
||||
3. Start the Service:
|
||||
|
||||
`Start-Service ssh-agent`
|
||||
|
||||
then
|
||||
|
||||
`cd ~`
|
||||
|
||||
4. Add your key as before:
|
||||
|
||||
`ssh-add <path to the key>`
|
||||
|
||||
|
||||
Creating config file : format
|
||||
|
||||
```
|
||||
Host github.com
|
||||
HostName github.com
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
Host github.com-work
|
||||
HostName github.com
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_rsa_work
|
||||
```
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
# Heroku
|
||||
|
||||
[Installation and Pushing Code](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/Heroku%20531d47e94b8843d7a0dc8ffce482bf9e/Installation%20and%20Pushing%20Code%20d782fb23e4a642358c74.md)
|
||||
|
||||
[Connecting with PostgreSQL Database](../../Export-9fad9947-5bd5-4195-952b-6512c5a4beb1/Web%20development%2083dd4e6675f04ba782a6865a434a0598/Heroku%20531d47e94b8843d7a0dc8ffce482bf9e/Connecting%20with%20PostgreSQL%20Database%2027806e96bc2941.md)
|
||||
|
||||
Heroku alternatives:
|
||||
|
||||
[https://www.youtube.com/watch?v=UZsMx_7LEj8](https://www.youtube.com/watch?v=UZsMx_7LEj8)
|
||||
|
||||
[https://www.youtube.com/watch?v=MusIvEKjqsc](https://www.youtube.com/watch?v=MusIvEKjqsc)
|
||||
|
||||
[https://bloggersdesire.com/hosting-trial-no-credit-card/](https://bloggersdesire.com/hosting-trial-no-credit-card/) : site
|
||||
|
||||
[https://www.guru99.com/free-web-hosting-sites.html](https://www.guru99.com/free-web-hosting-sites.html)
|
||||
|
||||
uptimerobot nodejs for bots
|
||||
|
||||
[https://www.staas.io/dashboard/stack?id=nodejsweek3305&cmd=restart&error=&success=Stack RESTART command is processed&data_id=Xf6PbWjQqrEuN3-W5K_tV](https://www.staas.io/dashboard/stack?id=nodejsweek3305&cmd=restart&error=&success=Stack%20RESTART%20command%20is%20processed&data_id=Xf6PbWjQqrEuN3-W5K_tV)
|
||||
|
||||
qovery
|
||||
glitch : for hosting
|
||||
|
||||
surge : for frontend
|
||||
[https://host.ehxz.tk/](https://host.ehxz.tk/)
|
||||
|
||||
replit
|
||||
|
||||
deta cloud: [https://www.deta.sh/](https://www.deta.sh/) nodejs
|
||||
|
||||
adaptable io
|
||||
|
||||
back4app
|
||||
|
||||
coolify : self hosted platform means we need our own server
|
||||
|
||||
for deta cloud server file should be index.js not app.js or server.js and at last of index.js add this:
|
||||
|
||||
`module.exports=app` where `app=express()`
|
||||
|
||||
elephantSQL : for postgreSQL
|
||||
|
||||
[https://supabase.com/pricing](https://supabase.com/pricing) : for postgres
|
||||
|
||||
[https://www.youtube.com/watch?v=prjMJtXCR-g](https://www.youtube.com/watch?v=prjMJtXCR-g) : with database too
|
||||
|
||||
[https://ekomenyong.com/posts/how-to-setup-free-postgresql-database-on-railway-app](https://ekomenyong.com/posts/how-to-setup-free-postgresql-database-on-railway-app)
|
||||
|
||||
[https://blog.railway.app/p/postgre-backup](https://blog.railway.app/p/postgre-backup)
|
||||
|
||||
- Puppeteer on render cloud
|
||||
|
||||
[https://render.com/docs/deploy-puppeteer-node](https://render.com/docs/deploy-puppeteer-node)
|
||||
|
||||
Browser as service : [https://dashboard.phantomjscloud.com/](https://dashboard.phantomjscloud.com/)
|
||||
|
||||
[https://phantomjscloud.com/docs/http-api/#script-examples](https://phantomjscloud.com/docs/http-api/#script-examples)
|
||||
|
||||
video related to it : [https://www.youtube.com/watch?v=lcSMCta1Bcg](https://www.youtube.com/watch?v=lcSMCta1Bcg)
|
||||
|
||||
uploading on vercel : [https://www.youtube.com/watch?v=X6VIWHl3JmM](https://www.youtube.com/watch?v=X6VIWHl3JmM)
|
||||
|
||||
- code for uploading in vercel
|
||||
|
||||
```jsx
|
||||
const btoa = require("btoa");
|
||||
const path = require("path");
|
||||
let chromium;
|
||||
// Check if we are running locally or on Vercel
|
||||
if (!process.env.AWS_LAMBDA_FUNCTION_VERSION) {
|
||||
const puppeteer = require("puppeteer");
|
||||
chromium = {
|
||||
puppeteer,
|
||||
};
|
||||
} else {
|
||||
chromium = require("chrome-aws-lambda");
|
||||
}
|
||||
const renderHTML = require("./render-html");
|
||||
|
||||
/**
|
||||
* Normalizes the theme name by adding a prefix `jsonresume-theme` if not present
|
||||
* @param {String} value Name of the theme
|
||||
* @param {String} defaultValue Default Theme
|
||||
*/
|
||||
const normalizeTheme = (value, defaultValue = "even") => {
|
||||
const theme = value || defaultValue;
|
||||
|
||||
// If theme has a relative path provided, immediately return
|
||||
if (theme[0] === ".") {
|
||||
return theme;
|
||||
}
|
||||
|
||||
return theme.match("jsonresume-theme-.*")
|
||||
? theme
|
||||
: `jsonresume-theme-${theme}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the theme Package
|
||||
* @param {String} theme Normalized theme name
|
||||
*/
|
||||
const getThemePackage = (theme) => {
|
||||
if (theme[0] === ".") {
|
||||
theme = path.join(process.cwd(), theme, "index.js");
|
||||
}
|
||||
|
||||
try {
|
||||
const themePackage = require(theme);
|
||||
return themePackage;
|
||||
} catch (err) {
|
||||
// Theme not installed
|
||||
throw new Error(
|
||||
"You have to install this theme relative to the folder to use it e.g. `npm install " +
|
||||
theme +
|
||||
"`"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses the `resumeJson` to render a pretty HTML
|
||||
* @param {Object} resumeJson Resume data
|
||||
* @param {String} themeName Name of the theme
|
||||
*/
|
||||
const parse = async (resumeJson, themeName) => {
|
||||
const html = await renderHTML({
|
||||
resume: resumeJson,
|
||||
themePath: themeName,
|
||||
});
|
||||
return html;
|
||||
};
|
||||
|
||||
// See https://vercel.com/knowledge/how-to-enable-cors
|
||||
const allowCors = (fn) => async (req, res) => {
|
||||
res.setHeader("Access-Control-Allow-Credentials", true);
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader(
|
||||
"Access-Control-Allow-Methods",
|
||||
"GET,OPTIONS,PATCH,DELETE,POST,PUT"
|
||||
);
|
||||
res.setHeader(
|
||||
"Access-Control-Allow-Headers",
|
||||
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
|
||||
);
|
||||
|
||||
// Handle CORS pre-flight
|
||||
if (req.method === "OPTIONS") {
|
||||
res.status(200).end();
|
||||
return;
|
||||
}
|
||||
|
||||
return await fn(req, res);
|
||||
};
|
||||
|
||||
const handler = async (req, res) => {
|
||||
try {
|
||||
const { resumeData } = req.body;
|
||||
const normalizedTheme = normalizeTheme(resumeData.meta.theme, "even");
|
||||
const themePackage = getThemePackage(normalizedTheme);
|
||||
const html = await parse(resumeData, normalizedTheme);
|
||||
const browser = await chromium.puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.emulateMediaType(
|
||||
(themePackage.pdfRenderOptions &&
|
||||
themePackage.pdfRenderOptions.mediaType) ||
|
||||
"screen"
|
||||
);
|
||||
await page.goto(
|
||||
`data:text/html;base64,${btoa(unescape(encodeURIComponent(html)))}`,
|
||||
{ waitUntil: "networkidle0" }
|
||||
);
|
||||
if (themePackage.pdfViewport) {
|
||||
await page.setViewport(themePackage.pdfViewport);
|
||||
}
|
||||
const pdf = await page.pdf({
|
||||
format: "Letter",
|
||||
printBackground: true,
|
||||
margin: {
|
||||
top: "0.5in",
|
||||
bottom: "0.5in",
|
||||
left: "0.5in",
|
||||
right: "0.5in",
|
||||
},
|
||||
...themePackage.pdfRenderOptions,
|
||||
});
|
||||
|
||||
await browser.close();
|
||||
|
||||
res.setHeader("Content-Type", "application/pdf");
|
||||
res.setHeader("Content-Length", pdf.length);
|
||||
res.send(pdf);
|
||||
} catch (err) {
|
||||
res.status(500);
|
||||
res.json({
|
||||
error: err,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = allowCors(handler);
|
||||
```
|
||||
|
||||
|
||||
- Glitch(to test the app without hosting)
|
||||
|
||||
[https://www.youtube.com/watch?v=3hVf4Giy5nc](https://www.youtube.com/watch?v=3hVf4Giy5nc)
|
||||
|
||||

|
||||
|
||||
- Puppeteer on glitch
|
||||
|
||||

|
||||
|
||||
this should be the version ie 1.3.0 not the latest one
|
||||
|
||||
```jsx
|
||||
const browser = await puppeteer.launch({
|
||||
args: ['--no-sandbox']
|
||||
});
|
||||
```
|
||||
|
||||
- FireBase
|
||||
|
||||
[https://www.youtube.com/watch?v=WaYPrpOvsZE](https://www.youtube.com/watch?v=WaYPrpOvsZE)
|
||||
|
||||
- Guide
|
||||
|
||||
To host a Node.js application in Firebase, you can follow these steps:
|
||||
|
||||
1. Set up Firebase: Visit the Firebase website (**[https://firebase.google.com/](https://firebase.google.com/)**) and create an account if you don't have one already. Once logged in, create a new project.
|
||||
2. Install Firebase CLI: Install the Firebase Command Line Interface (CLI) globally on your machine by running the following command in your terminal:
|
||||
|
||||
```
|
||||
Copy code
|
||||
npm install -g firebase-tools
|
||||
|
||||
```
|
||||
|
||||
3. Initialize Firebase: In your terminal, navigate to your Node.js project's root directory. Run the following command to initialize Firebase within your project:
|
||||
|
||||
```
|
||||
csharpCopy code
|
||||
firebase init
|
||||
|
||||
```
|
||||
|
||||
This will prompt you to select the Firebase features you want to use. Choose "Hosting" and select your Firebase project from the list.
|
||||
|
||||
4. Configure Firebase Hosting: During the initialization process, you'll be asked to configure Firebase Hosting. Set the public directory to the folder containing your Node.js application's static files. If your Node.js app serves static files from a **`public`** folder, you can specify it as the public directory. Firebase Hosting is designed to host static files, so for a Node.js application, you'll need to configure Firebase to serve the static files while handling dynamic requests.
|
||||
5. Modify Firebase Configuration (Optional): If your Node.js application requires additional server-side configuration, you can modify the generated **`firebase.json`** file to include a **`rewrites`** property. This allows you to define rules for routing requests to your Node.js application. For example:
|
||||
|
||||
```
|
||||
jsonCopy code
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "**",
|
||||
"function": "yourNodeJsFunction"
|
||||
}
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
This configuration redirects all requests to your Node.js function. Replace **`"yourNodeJsFunction"`** with the appropriate function name.
|
||||
|
||||
6. Deploy to Firebase Hosting: Once your configuration is complete, deploy your Node.js application to Firebase Hosting by running the following command:
|
||||
|
||||
```
|
||||
Copy code
|
||||
firebase deploy
|
||||
|
||||
```
|
||||
|
||||
This will upload your static files and deploy your Node.js application to Firebase Hosting.
|
||||
|
||||
7. Access Your Deployed Application: After the deployment is successful, Firebase will provide you with a URL where your Node.js application is hosted. You can access it from any web browser.
|
||||
|
||||
Keep in mind that Firebase Hosting is primarily designed for hosting static files, so it might not be suitable for all types of Node.js applications. If your application has specific server-side requirements or requires more complex routing and API functionality, you might need to consider other hosting options like virtual private servers (VPS), cloud platforms, or dedicated Node.js hosting providers.
|
||||
|
||||
Also, ensure that your Node.js application is properly configured to handle production deployments and security considerations such as environment variables and authentication mechanisms.
|
||||
|
||||
for testing locally use `firebase serve`
|
||||
|
||||
|
||||
- Video hosting platform
|
||||
|
||||
1: vimeo
|
||||
2: vidyard
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
# Connecting with PostgreSQL Database
|
||||
|
||||
- Local important commands for exporting and importing
|
||||
|
||||
### Exporting postgresql Database
|
||||
|
||||
We need to create a dump file. Here *smart-brain* is name of database
|
||||
|
||||
`pg_dump -U postgres smart-brain > dump.sql`
|
||||
|
||||
### Importing postgresql Database
|
||||
|
||||
`psql -U postgres smart-brain < dump.sql`
|
||||
|
||||
For using insert into instead of copy: [https://stackoverflow.com/questions/2827072/sql-convert-backup-file-from-copy-format-to-insert-format](https://stackoverflow.com/questions/2827072/sql-convert-backup-file-from-copy-format-to-insert-format)
|
||||
|
||||
`pg_dump --column-inserts -U <dbuser> <database> > dumpWithInserts.sql`
|
||||
|
||||
for railway cloud:
|
||||
|
||||
[https://blog.railway.app/p/postgre-backup](https://blog.railway.app/p/postgre-backup)
|
||||
|
||||
The above may not work well in windows so we can use the pgadmin which is workbench. To create dump file use backup functionality with binary encoding. This dump file can be easily imported using restore functionality.
|
||||
|
||||
Some extra functionality like:
|
||||
|
||||
To get list of tables: `\d`
|
||||
|
||||
to get schema of table ‘users’: `\d users;`
|
||||
|
||||
|
||||
### Importing dump file to heroku created by pgadmin
|
||||
|
||||
dump file to be imported to heroku must be publically accessible http url. Dropbox is recommended and remove letter ‘s’ from https(https→ http).
|
||||
|
||||
`heroku pg: backups: restore ‘http://…..’`
|
||||
|
||||
- Configuration for postgreSQL in nodejs for production mode:
|
||||
|
||||
```jsx
|
||||
const knex = require("knex")({
|
||||
client: "pg",
|
||||
connection: {
|
||||
// host: "127.0.0.1",
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
ssl: { rejectUnauthorized: false },
|
||||
|
||||
|
||||
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
This database_url is to be uploaded in heroku config file section under settings when navigated to the particular app.Refer to the image:
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
This database_url can be accessed by using the heroku command:
|
||||
|
||||
heroku pg:info
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
This add-on property contains databse url.
|
||||
|
||||
|
||||
### Accessing database through command prompt:
|
||||
|
||||
`heroku pg:psql -a face-extractor-app`
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# Installation and Pushing Code
|
||||
|
||||
## I**nstallation**
|
||||
|
||||
- At root directory of nodejs app
|
||||
|
||||
```bash
|
||||
git init
|
||||
git add .
|
||||
git commit -m 'initialize'
|
||||
```
|
||||
|
||||
|
||||
• (Make sure to install heroku cli)
|
||||
|
||||
`• heroku create or heroku create appname`
|
||||
|
||||
- If there is already an existing app then we need to change the prev origin to current one by:
|
||||
|
||||
`heroku git:remote -a appname`
|
||||
|
||||
- For changing app name, remote name has to be changed too.
|
||||
|
||||
```bash
|
||||
git remote rename heroku newname
|
||||
```
|
||||
|
||||
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
git remote heroku newname
|
||||
heroku git:remote -a newname
|
||||
```
|
||||
|
||||
- For changing app name(this has to be done before)
|
||||
|
||||
`heroku apps: rename newname`
|
||||
|
||||
or for outside git repository
|
||||
|
||||
`heroku apps: rename newname —app oldname`
|
||||
|
||||
## **Pushing Code**
|
||||
|
||||
`git push heroku main`
|
||||
|
||||
For non-main branch:
|
||||
|
||||
`git push heroku testbranch:main`
|
||||
|
||||
**In nodejs app:**
|
||||
|
||||
```jsx
|
||||
app.listen(process.env.PORT || 3000,()=>{
|
||||
console.log('listening');
|
||||
})
|
||||
```
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
# Javascript
|
||||
|
||||
- **Split regex**
|
||||
|
||||
1: when using split function using regex, if we want to include delimiters in array instead of just skipping them then we need to include brackets for delimiters.
|
||||
for eg:
|
||||
|
||||
```jsx
|
||||
calcInput='2*3'
|
||||
let arr = calcInput.split(/([*\/+-])/);
|
||||
// arr-> ['2', '*', '3']
|
||||
without brackets split(/[*\/+-])/)
|
||||
// arr=['2', '3']
|
||||
```
|
||||
|
||||
|
||||
2: **typeof**: to get type of literal.
|
||||
|
||||
for eg:
|
||||
|
||||
`typeof 'str’` -> ‘string’
|
||||
|
||||
- regex reference
|
||||
|
||||
[JavaScript RegExp Reference](https://www.w3schools.com/jsref/jsref_obj_regexp.asp)
|
||||
|
||||
```python
|
||||
import re
|
||||
In [14]: par = "This is a paragraph? So it is! Ok, there are 3 sentences."
|
||||
In [15]: re.split(r'[.!?]+', par)
|
||||
Out[15]: ['This is a paragraph', ' So it is', ' Ok, there are 3 sentences', '']
|
||||
```
|
||||
|
||||
for splitting sentences in python
|
||||
|
||||
- Parsing using regex
|
||||
|
||||
Suppose if we wnna extract id from url or text then
|
||||
|
||||
`id = /var k__id = "(.*?)"/.exec(result)[1]`
|
||||
|
||||
also to extract id from embed youtube video.
|
||||
|
||||
for eg:
|
||||
|
||||
```jsx
|
||||
let url="[https://www.youtube.com/embed/Ko58_KjgM0E](https://www.youtube.com/embed/Ko58_KjgM0E)"
|
||||
let reg=/embed\/(.*)/
|
||||
const id=reg.exec('https://www.youtube.com/embed/Ko58_KjgM0E')[1]
|
||||
|
||||
// Output:
|
||||
// "Ko58_KjgM0E"
|
||||
```
|
||||
|
||||
- Using fetch to send form data
|
||||
|
||||
in body use format `<key>=<value>` and use `content-type: "application/x-www-form-urlencoded"`.
|
||||
|
||||
```jsx
|
||||
const getToken = async () => {
|
||||
const url = "https://accounts.spotify.com/api/token";
|
||||
const authOptions = {
|
||||
method: "post",
|
||||
// url: "https://accounts.spotify.com/api/token",
|
||||
headers: {
|
||||
Authorization:
|
||||
"Basic " +
|
||||
new Buffer(clientID + ":" + clientSecret).toString("base64"),
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
// form data with key 'grant_type' and value 'client_credentials'
|
||||
// written as
|
||||
body: "grant_type=client_credentials",
|
||||
|
||||
// json: true,
|
||||
};
|
||||
|
||||
const result = await fetch(url, authOptions);
|
||||
const data = await result.json();
|
||||
return data.access_token;
|
||||
};
|
||||
```
|
||||
|
||||
- HTTP basics
|
||||
|
||||
[https://eloquentjavascript.net/18_http.html](https://eloquentjavascript.net/18_http.html#HTTP%201.1)
|
||||
|
||||
- onchange on select element
|
||||
|
||||
Another approach which can be handy in some situations, is passing the value of the selected `<option />` directly to the function like this:
|
||||
|
||||
```jsx
|
||||
function myFunction(chosen) {
|
||||
console.log(chosen);
|
||||
}
|
||||
|
||||
<select onChange="myFunction(this.options[this.selectedIndex].value)">
|
||||
<option value="1">Text 1</option>
|
||||
<option value="2">Text 2</option>
|
||||
</select>
|
||||
```
|
||||
- for react
|
||||
```jsx
|
||||
<select
|
||||
onChange={(e) =>
|
||||
myFunction(e.target.options[e.target.selectedIndex].value)
|
||||
}
|
||||
```
|
||||
- Stimulate ctrl+click event
|
||||
|
||||
[https://stackoverflow.com/questions/34255506/simulate-ctrl-click-with-javascript-or-jquery-to-open-a-new-tab-without-focus](https://stackoverflow.com/questions/34255506/simulate-ctrl-click-with-javascript-or-jquery-to-open-a-new-tab-without-focus)
|
||||
|
||||
In pure javascript, you can use the `[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)` for that:
|
||||
|
||||
```jsx
|
||||
document.getElementById("todo").dispatchEvent(new MouseEvent("click", {ctrlKey: true}));
|
||||
|
||||
```
|
||||
|
||||
To programatically open a new tab you can do that:
|
||||
|
||||
```jsx
|
||||
const a = document.createElement("a");
|
||||
a.setAttribute("href", "https://www.google.com/");
|
||||
a.dispatchEvent(new MouseEvent("click", {ctrlKey: true}));
|
||||
```
|
||||
|
||||
- Local storage
|
||||
|
||||
```jsx
|
||||
const notestring = localStorage.getItem("notes");
|
||||
|
||||
// we can store objects so we need to convert them in json string first
|
||||
const arrString = JSON.stringify(notes);
|
||||
localStorage.setItem("notes", arrString);
|
||||
// here 'notes' is key and arrString is value
|
||||
|
||||
// to remove the key
|
||||
localStorage.removeItem("notes");
|
||||
```
|
||||
|
||||
- Use npm package in vanilla js
|
||||
|
||||
install browserify using
|
||||
|
||||
`npm install -g browserify`
|
||||
|
||||
then install npm package in same directory
|
||||
|
||||
`npm i js-crypto-rsa`
|
||||
|
||||
script.js
|
||||
|
||||
```jsx
|
||||
const rsa=require('js-crypto-rsa')
|
||||
|
||||
const key=rsa.generateKey(2048)
|
||||
|
||||
```
|
||||
|
||||
finally use
|
||||
|
||||
`browserify script.js -o bundle.js`
|
||||
|
||||
in index.html
|
||||
|
||||
`<script src="bundle.js"></script>`
|
||||
|
|
@ -0,0 +1,983 @@
|
|||
# Linux
|
||||
|
||||
- File structure
|
||||
|
||||
bin: executables
|
||||
|
||||
sbin: system binaries and require root
|
||||
|
||||
lib: bin and sbin store common libraries
|
||||
|
||||
usr → bin: non essential installed binaries
|
||||
|
||||
usr → local → bin : locally compiled, its separate to stop conflict when installed from apt,snap,etc.
|
||||
|
||||
etc(editable text configuration): contains config files, executables for booting and log files
|
||||
|
||||
home: contains data of all users
|
||||
|
||||
boot: for booting linux kernel
|
||||
|
||||
- GUI Resource Manager
|
||||
|
||||
Stacer
|
||||
|
||||
[stacer_1.1.0+ds-1_amd64.deb](../../_resources/stacer_1.1.0ds-1_amd64.deb)
|
||||
|
||||
[bleachbit_4.4.2-1_all.deb](../../_resources/bleachbit_4.4.2-1_all.deb)
|
||||
|
||||
- Uninstalling
|
||||
|
||||
```bash
|
||||
sudo apt-get remove heroku-toolbelt
|
||||
```
|
||||
|
||||
When you remove a package in Ubuntu, the packaged data is removed, but it may leave small, modified user configuration files. This is intentional because if you install the same program again, it would use those configuration files.
|
||||
|
||||
If you want to remove it completely, you can use apt purge command. You can use it instead of apt remove command or after running the apt remove command.
|
||||
|
||||
```
|
||||
sudo apt purge program_name
|
||||
```
|
||||
|
||||
command that cleans up leftover package traces like dependencies that are no longer used, old Linux kernel headers that won’t be used anymore.
|
||||
|
||||
In the terminal, just run this command:
|
||||
|
||||
```
|
||||
sudo apt autoremove
|
||||
```
|
||||
|
||||
To get a list of dependency:(For debian only)
|
||||
|
||||
`dpkg -l | grep 'geany' | awk '{print $2}' | tr "\n" " “`
|
||||
|
||||
- Handwritten
|
||||
|
||||
[linux.pdf](../../_resources/linux.pdf)
|
||||
|
||||
[linux.pdf](../../_resources/linux%201.pdf)
|
||||
|
||||
- Basics
|
||||
|
||||
|
||||
- Aliases
|
||||
|
||||
```bash
|
||||
myFold="~/Files/Scripts/Main"
|
||||
cd $myFold
|
||||
```
|
||||
|
||||
for permanent
|
||||
|
||||
[https://phoenixnap.com/kb/linux-set-environment-variable](https://phoenixnap.com/kb/linux-set-environment-variable)
|
||||
|
||||
# **Set an Environment Variable in Linux Permanently**
|
||||
|
||||
If you wish a variable to persist after you close the shell session, you need to set it as an environmental variable permanently. You can choose between setting it for the current user or all users.
|
||||
|
||||
1. To set permanent environment variables for a single user, [edit the .bashrc file](https://phoenixnap.com/kb/bashrc):
|
||||
|
||||
```
|
||||
sudo nano ~/.bashrc
|
||||
```
|
||||
|
||||
2. Write a line for each variable you wish to add using the following syntax:
|
||||
|
||||
```
|
||||
export [VARIABLE_NAME]=[variable_value]
|
||||
```
|
||||
|
||||

|
||||
|
||||
3. Save and exit the file. The changes are applied after you restart the shell. If you want to apply the changes during the current session, use the [source command](https://phoenixnap.com/kb/linux-source-command):
|
||||
|
||||
```
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
4. To set permanent environment variables for all users, create an **`.sh`** file in the **`/etc/profile.d`** folder:
|
||||
|
||||
```
|
||||
sudo nano /etc/profile.d/[filename].sh
|
||||
```
|
||||
|
||||
5. The syntax to add variables to the file is the same as with **`.bashrc`**:
|
||||
|
||||

|
||||
|
||||
6. Save and exit the file. The changes are applied at the next logging in.
|
||||
|
||||
Alias commands
|
||||
|
||||
|
||||
which command: to get path of certain app:
|
||||
|
||||
```
|
||||
$ which heroku
|
||||
/snap/bin/heroku
|
||||
```
|
||||
|
||||
Completey remove folder with contents:
|
||||
|
||||
`sudo rm -r heroku`
|
||||
|
||||
for chamging names
|
||||
|
||||
`for file in [y2mate.com](http://y2mate.com/)*; do
|
||||
mv "$file" "${file/y2mate.com -/}"
|
||||
done`
|
||||
|
||||
- chagpt example
|
||||
|
||||
If you want to rename files that start with **`[SPOTIFY-DOWNLOADER.COM]`** and remove that part, you can use a similar **`rename`** command with a regular expression. Here's how you can do it:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
rename 's/^\[SPOTIFY-DOWNLOADER\.COM\]//' '[SPOTIFY-DOWNLOADER.COM]'*
|
||||
|
||||
```
|
||||
|
||||
This command will search for files that start with **`[SPOTIFY-DOWNLOADER.COM]`** and replace that part with an empty string, effectively removing it from the filenames. Make sure to use single quotes around the pattern **`[SPOTIFY-DOWNLOADER.COM]*`** to prevent shell expansion of the square brackets.
|
||||
|
||||
As always, it's a good idea to test this command on a small set of files or create backups before applying it to your entire file set.
|
||||
|
||||
|
||||
- Installing
|
||||
|
||||
Step 1. Before running the tutorial below, it’s important to make sure your system is up to date by running the following `apt` commands in the terminal:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install software-properties-common apt-transport-https wget ca-certificates gnupg2
|
||||
```
|
||||
|
||||
Step 2. Installing VSCodium on Linux Mint 21.
|
||||
|
||||
By default, VSCodium is not available on the Linux Mint 21 base repository. Now we add the VSCodium repository to your system using the following command:
|
||||
|
||||
```bash
|
||||
echo deb [signed-by=/usr/share/keyrings/vscodium.gpg] https://download.vscodium.com/debs vscodium main | sudo tee /etc/apt/sources.list.d/vscodium.list
|
||||
```
|
||||
|
||||
Next, import the GPG key:
|
||||
|
||||
```bash
|
||||
sudo wget -O- https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/vscodium.gpg
|
||||
```
|
||||
|
||||
Now start by updating the packages list and install VSCodium stable by using the command below:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install codium
|
||||
```
|
||||
|
||||
- Important tools and softwares
|
||||
|
||||
`sudo apt install glances` : better task manager
|
||||
|
||||

|
||||
|
||||
it is extension of task manager
|
||||
|
||||
- Taskbar groupping icon
|
||||
|
||||
1. Hold down Control and click on one of the tabs. This will open up the menu for `Window Buttons` (aka Tasklist).
|
||||
2. Click on `Properties`.
|
||||
3. Select "Never" from the `Window grouping` option (in the **Behaviour** section of the dialog)
|
||||
4. Make a note of how to do this because you'll probably want to re-enable grouping if you ever run an app (e.g. a web browser) with dozens of windows open.
|
||||
|
||||
- Get access to priviledged section
|
||||
|
||||
`sudo chmod 755 /usr/local/bin`/codejava
|
||||
|
||||
- Virtual box
|
||||
|
||||
For resizing fix: [https://www.youtube.com/watch?v=yrasRjq3HXw](https://www.youtube.com/watch?v=yrasRjq3HXw)
|
||||
|
||||
- Fun fact
|
||||
|
||||
When typing vi google will say:
|
||||
Did you mean : emacs
|
||||
|
||||
and When typing emacs google will say:
|
||||
|
||||
Did you mean : vi
|
||||
|
||||
- VPN in linux
|
||||
|
||||
[https://atlasvpn.com/vpn-for-linux](https://atlasvpn.com/vpn-for-linux)
|
||||
|
||||
- Linux in mobile
|
||||
|
||||
[https://wiki.termux.com/wiki/Termux-setup-storage](https://wiki.termux.com/wiki/Termux-setup-storage)
|
||||
|
||||
In order to have access to shared storage (/sdcard or /storage/emulated/0), Termux needs a storage access permission. It is not granted by default and is not requested on application startup since it is not necessary for normal application functioning.
|
||||
|
||||
Execute command `termux-setup-storage`
|
||||
|
||||
- Commands
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- Installing xdm
|
||||
|
||||
[https://www.youtube.com/watch?v=cdMiAgQe3_I](https://www.youtube.com/watch?v=cdMiAgQe3_I)
|
||||
|
||||
|
||||
[xdm-browser-monitor-master.zip](../../_resources/xdm-browser-monitor-master-1.zip)
|
||||
|
||||
- here is the solutions
|
||||
|
||||
download https://github.com/subhra74/xdm-browser-monitor as a zip and extract it
|
||||
|
||||
then go to the chrome extension page and activate developper mode
|
||||
|
||||
then click load extension on the top left and select the chrome folder inside the extracted zip
|
||||
|
||||
after that just clear the error if there is and you are done
|
||||
|
||||
|
||||
|
||||
- Terminal scrolling
|
||||
|
||||
You can temporarily ***prevent scrolling*** by hitting CTRL-S on the keyboard, which will pause output until you hit CTRL-Q.
|
||||
|
||||
- Rhythmbox
|
||||
- **[Board index](https://forums.linuxmint.com/index.php?sid=69cc8b37f90128fea74650ce5fe17d4b)[Main Edition Support](https://forums.linuxmint.com/viewforum.php?f=126&sid=69cc8b37f90128fea74650ce5fe17d4b)[Hardware Support](https://forums.linuxmint.com/viewforum.php?f=49&sid=69cc8b37f90128fea74650ce5fe17d4b)[Sound](https://forums.linuxmint.com/viewforum.php?f=48&sid=69cc8b37f90128fea74650ce5fe17d4b)**
|
||||
|
||||
## [[solved] Rhythmbox: multiple library locations does not work](https://forums.linuxmint.com/viewtopic.php?t=14218&sid=69cc8b37f90128fea74650ce5fe17d4b)
|
||||
|
||||
**Forum rules**Before you post please read [how to get help](https://forums.linuxmint.com/viewtopic.php?f=17&t=83444). Topics in this forum are automatically closed 6 months after creation.
|
||||
|
||||
**[Locked](https://forums.linuxmint.com/posting.php?mode=reply&t=14218&sid=69cc8b37f90128fea74650ce5fe17d4b)**
|
||||
|
||||
**Search[Advanced search](https://forums.linuxmint.com/search.php?sid=69cc8b37f90128fea74650ce5fe17d4b)**
|
||||
|
||||
2 posts • Page **1** of **1**
|
||||
|
||||
**[hans123](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=2232&sid=69cc8b37f90128fea74650ce5fe17d4b)**Level 3Posts: [147](https://forums.linuxmint.com/search.php?author_id=2232&sr=posts&sid=69cc8b37f90128fea74650ce5fe17d4b)Joined: Mon Jun 11, 2007 11:15 am
|
||||
|
||||

|
||||
|
||||
### **[[solved] Rhythmbox: multiple library locations does not work](https://forums.linuxmint.com/viewtopic.php?p=87971&sid=69cc8b37f90128fea74650ce5fe17d4b#p87971)**
|
||||
|
||||
[Post](https://forums.linuxmint.com/viewtopic.php?p=87971&sid=69cc8b37f90128fea74650ce5fe17d4b#p87971) by **[hans123](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=2232&sid=69cc8b37f90128fea74650ce5fe17d4b)** » June 28, 2008 6:01 PM
|
||||
|
||||
I am trying to add multiple directories where my audio files are located to Rhythmbox. This can only be done with gconf-editor by adding directory URIs to the value /apps/rhythmbox/library_locations.But somehow this does not work for me: The list "library_locations" contains '/media/sda10/music,/media/sda8/My Music' but these directories are not monitored or added in Rhythmbox itself. The directory notation I used is the same that Rhythmbox shows when selecting a Library Location in the preferences (with Browse).What am I doing wrong?
|
||||
|
||||
Last edited by **[LockBot](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=338753&sid=69cc8b37f90128fea74650ce5fe17d4b)** on Wed Dec 28, 2022 7:16 am, edited 2 times in total.**Reason:** *Topic automatically closed 6 months after creation. New replies are no longer allowed.*
|
||||
|
||||
[Top](https://forums.linuxmint.com/viewtopic.php?t=14218#top)
|
||||
|
||||
**[hans123](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=2232&sid=69cc8b37f90128fea74650ce5fe17d4b)**Level 3Posts: [147](https://forums.linuxmint.com/search.php?author_id=2232&sr=posts&sid=69cc8b37f90128fea74650ce5fe17d4b)Joined: Mon Jun 11, 2007 11:15 am
|
||||
|
||||

|
||||
|
||||
### **[Re: Rhythmbox: multiple library locations does not work](https://forums.linuxmint.com/viewtopic.php?p=88261&sid=69cc8b37f90128fea74650ce5fe17d4b#p88261)**
|
||||
|
||||
[Post](https://forums.linuxmint.com/viewtopic.php?p=88261&sid=69cc8b37f90128fea74650ce5fe17d4b#p88261) by **[hans123](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=2232&sid=69cc8b37f90128fea74650ce5fe17d4b)** » June 30, 2008 3:03 AM
|
||||
|
||||
I do not know what you did wrong, but here is a workaround: Point to one directory in Rhythmbox / Pref's / Music / Library Locations. Create Sym Links to the other directories where you keep your music in that one directory and you are set. (So, do not use GConf-Editor) Good Luck!
|
||||
|
||||
[Top](https://forums.linuxmint.com/viewtopic.php?t=14218#top)
|
||||
|
||||
**[Locked](https://forums.linuxmint.com/posting.php?mode=reply&t=14218&sid=69cc8b37f90128fea74650ce5fe17d4b)**
|
||||
|
||||
- Audio equalizer
|
||||
|
||||
[https://linuxhint.com/install-pulseaudio-equalizer-linux-mint/](https://linuxhint.com/install-pulseaudio-equalizer-linux-mint/)
|
||||
|
||||
to start, type `qpaeq` in terminal
|
||||
|
||||
|
||||
- For clearing ram cache
|
||||
|
||||
To clear the RAM cache in Linux, you can use the following methods:
|
||||
|
||||
1. Clear PageCache:
|
||||
|
||||
```
|
||||
shellCopy code
|
||||
$ sudo sync && echo 1 | sudo tee /proc/sys/vm/drop_caches
|
||||
|
||||
```
|
||||
|
||||
2. Clear dentries and inodes:
|
||||
|
||||
```
|
||||
shellCopy code
|
||||
$ sudo sync && echo 2 | sudo tee /proc/sys/vm/drop_caches
|
||||
|
||||
```
|
||||
|
||||
3. Clear PageCache, dentries, and inodes:
|
||||
|
||||
```
|
||||
shellCopy code
|
||||
$ sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
|
||||
|
||||
```
|
||||
|
||||
- Notion app
|
||||
|
||||
[https://filelu.com/azswmk187wnl](https://filelu.com/azswmk187wnl)
|
||||
|
||||
- Adding executable on start menu
|
||||
|
||||
**20**
|
||||
|
||||
If you have a launcher in your desktop, then copy/move the launcher from your desktop to the `~/.local/share/applications/` directory. It should appear in the menu.
|
||||
|
||||
Otherwise, you may manually create a simple `.desktop` launcher (say `eclipse.desktop`) in your `~/.local/share/applications/` directory. The content of the `eclipse.desktop` may be as follows.
|
||||
|
||||
```
|
||||
[Desktop Entry]
|
||||
Name=Eclipse
|
||||
Exec=/full/path/to/the/executable
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=/full/path/to/the/icon-file
|
||||
```
|
||||
|
||||
- Autocomplete
|
||||
|
||||
Using autocomplete is as simple as **pressing the [TAB] and the active command line options will fill in**
|
||||
|
||||
|
||||
- Making custom command
|
||||
|
||||
To create a bash script, enter the following code:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
#on displays the actual folder name
|
||||
echo "the folder is 'pwd'"
|
||||
#then the rest of the files
|
||||
echo "The folder which contains files are 'ls'"
|
||||
```
|
||||
|
||||
Save this file by pressing **CTRL + O** with Nano. Give it the name of your command.
|
||||
|
||||
## **How to make the command executable?**
|
||||
|
||||
If you try to type the name of your bash script, you will notice that it will be executed (run).
|
||||
|
||||
Now, you have to modify the **CHMOD** of the script that you will run by typing:
|
||||
|
||||
```bash
|
||||
chmod +x yourScript
|
||||
```
|
||||
|
||||
Now, copy your script in the path, **/usr/bin**, like below:
|
||||
|
||||
```bash
|
||||
cp yourscript /usr/bin/
|
||||
```
|
||||
|
||||
- Network issues
|
||||
|
||||
When using proton vpn, it can have some effect on dns so using these we can fix problem.
|
||||
|
||||
`nmcli connection show —active`
|
||||
|
||||
output:
|
||||
|
||||
<router_company> … … …
|
||||
|
||||
pvpn-ipv6…. … … …
|
||||
|
||||
`sudo nmcli connection delete pvpn-ipv6…` and
|
||||
|
||||
`sudo nmcli connection delete pvpn-killswitch`(if such there)
|
||||
|
||||
There is another one which is convinent which is change to google dns ie 8.8.8.8
|
||||
|
||||
sudo tee /etc/resolv.conf <<< “nameserver 8.8.8.8”
|
||||
|
||||
and then restart server by
|
||||
|
||||
`sudo service NetworkManager restart` : for ubuntu
|
||||
|
||||
Note: original resolv.conf for linux mint:
|
||||
|
||||
```
|
||||
nameserver 127.0.0.53
|
||||
options edns0 trust-ad
|
||||
```
|
||||
|
||||
- Docker
|
||||
|
||||
[https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository](https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository) : documentation
|
||||
|
||||
[https://www.youtube.com/watch?v=Y4ut8kKpPUs](https://www.youtube.com/watch?v=Y4ut8kKpPUs) : video guide
|
||||
|
||||
```
|
||||
sudo apt-get update
|
||||
$ sudo apt-get install ca-certificates curl gnupg lsb-release
|
||||
(these 4 packages are essential, if already installed then ignore this line)
|
||||
```
|
||||
|
||||
`sudo mkdir -p /etc/apt/keyrings`
|
||||
|
||||
-p flag to create directories if not already created
|
||||
|
||||
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg`
|
||||
|
||||
```
|
||||
echo \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
```
|
||||
|
||||
Now go to folder /etc/apt/sources.list.d and open file named ‘docker.list’. The contents are:
|
||||
`deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] [https://download.docker.com/linux/ubuntu](https://download.docker.com/linux/ubuntu) vera stable`
|
||||
|
||||
Change **vera** to **jammy** if using linux mint
|
||||
|
||||
`sudo apt-get update`
|
||||
|
||||
for installing docker engine
|
||||
|
||||
`sudo apt-get install docker-ce docker-ce-cli [containerd.io](http://containerd.io/) docker-buildx-plugin docker-compose-plugin`
|
||||
|
||||
- Offline installation
|
||||
|
||||
To download setup(.deb package instead of directly installing it in order to store them for future installation
|
||||
|
||||
1. Use **`apt-get download`** to download the desired software and its dependencies. For example, for the package
|
||||
2. `sudo apt-get download package-name`
|
||||
This command will download the .deb packages (or other package format used by your distribution) to the current directory.
|
||||
3. Copying packages to the target machine (without internet access):
|
||||
- Transfer the downloaded package files (with .deb extension) to the target machine using a USB drive, network sharing, or any other method you prefer.
|
||||
4. Installing packages on the target machine:
|
||||
- Use **`apt`** to install the downloaded packages. Navigate to the directory containing the .deb packages and run:
|
||||
|
||||
```bash
|
||||
|
||||
sudo apt install ./package-name.deb
|
||||
|
||||
```
|
||||
|
||||
**Note**: Before this you need to give _apt permission to download it somewhere else like home or root. Its optional and is to avoid warning
|
||||
|
||||
```
|
||||
sudo chown -Rv _apt:root /var/cache/apt/archives/partial/
|
||||
sudo chmod -Rv 700 /var/cache/apt/archives/partial/
|
||||
```
|
||||
|
||||
- For automatic keypressing
|
||||
|
||||
|
||||
Download xdotool
|
||||
|
||||
[http://apt.ubuntu.com/p/xdotool](http://apt.ubuntu.com/p/xdotool) or
|
||||
|
||||
`apt-get install xdotool`
|
||||
|
||||
- xbinding
|
||||
1. **Install `xbindkeys` and `xdotool` if not already installed:**
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
sudo apt-get install xbindkeys xdotool
|
||||
|
||||
```
|
||||
|
||||
2. **Create the kill switch script:**
|
||||
|
||||
Create a script named **`kill_script.sh`** with the following content:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
#!/bin/bash
|
||||
# Kill the running script using pkill
|
||||
pkill -f mouse_click_script.sh # Replace with your script name
|
||||
|
||||
```
|
||||
|
||||
Make it executable with: **`chmod +x kill_script.sh`**
|
||||
|
||||
3. **Create or edit the `~/.xbindkeysrc` configuration file:**
|
||||
|
||||
If you don't have a **`~/.xbindkeysrc`** file, create one. If you do, open it for editing.
|
||||
|
||||
Add the following line to bind a key combination to the kill script:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
"bash /path/to/kill_script.sh"
|
||||
Control+Shift+Delete # Customize the key combination as desired
|
||||
|
||||
```
|
||||
|
||||
Make sure to replace **`/path/to/kill_script.sh`** with the actual path to your kill script and customize the key combination.
|
||||
|
||||
4. **Restart `xbindkeys` to apply changes:**
|
||||
|
||||
Restart the **`xbindkeys`** service to apply your changes:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
killall xbindkeys
|
||||
xbindkeys
|
||||
|
||||
```
|
||||
|
||||
|
||||
To press a key (in this example 'a') every two seconds you can use a script like this :
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
xdotool key a
|
||||
sleep 2
|
||||
done
|
||||
```
|
||||
|
||||
- Keycodes list
|
||||
|
||||
Up
|
||||
Down
|
||||
Left
|
||||
Right
|
||||
F1
|
||||
F2
|
||||
F3
|
||||
F4
|
||||
F5
|
||||
F6
|
||||
F7
|
||||
F8
|
||||
F9
|
||||
F10
|
||||
F11
|
||||
F12
|
||||
Escape
|
||||
Return
|
||||
Enter
|
||||
Tab
|
||||
BackSpace
|
||||
Delete
|
||||
Insert
|
||||
Home
|
||||
End
|
||||
Page_Up
|
||||
Page_Down
|
||||
Pause
|
||||
Print
|
||||
Scroll_Lock
|
||||
Num_Lock
|
||||
Caps_Lock
|
||||
Shift_L
|
||||
Shift_R
|
||||
Control_L
|
||||
Control_R
|
||||
Meta_L
|
||||
Meta_R
|
||||
Alt_L
|
||||
Alt_R
|
||||
Super_L
|
||||
Super_R
|
||||
Hyper_L
|
||||
Hyper_R
|
||||
|
||||
|
||||
- Wine
|
||||
|
||||
[https://phoenixnap.com/kb/how-to-install-wine-on-ubuntu](https://phoenixnap.com/kb/how-to-install-wine-on-ubuntu)
|
||||
|
||||
for installing gecko
|
||||
|
||||
`wget [https://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86_64.msi](https://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86_64.msi)`
|
||||
|
||||
`mv wine-gecko-2.47.1-x86_64.msi ~/.wine/drive_c/windows/system32/gecko/`
|
||||
|
||||
`wineboot` when using for first time
|
||||
|
||||
to open uninstaller use
|
||||
|
||||
`wine uninstaller`
|
||||
|
||||
`wine regedit` --for opening regedit
|
||||
|
||||
to install or open files use
|
||||
|
||||
`wine start idman.exe` .
|
||||
|
||||
`remove wine and wineboot` to bring back to its default state and uninstalling all programs
|
||||
|
||||
- Blank browser pages in chromium browsers
|
||||
|
||||
[https://www.ghacks.net/2023/07/12/chromium-based-browsers-are-not-loading-pages-properly-on-linux-heres-how-to-fix-it/](https://www.ghacks.net/2023/07/12/chromium-based-browsers-are-not-loading-pages-properly-on-linux-heres-how-to-fix-it/)
|
||||
|
||||
- Free up space
|
||||
|
||||
[https://www.youtube.com/watch?v=7URA1MnuEi8](https://www.youtube.com/watch?v=7URA1MnuEi8)
|
||||
|
||||
[https://www.tecmint.com/free-disk-space-ubuntu-linux-mint/](https://www.tecmint.com/free-disk-space-ubuntu-linux-mint/)
|
||||
|
||||
- Free swap space
|
||||
|
||||
However, if you really feel that you need to force it, (I can see a scenario where you would want to know the system will be responsive later) you can momentarily disable and re-enable swap
|
||||
|
||||
```
|
||||
sudo swapoff -a
|
||||
sudo swapon -a
|
||||
|
||||
```
|
||||
|
||||
OR alternatively as a single line
|
||||
|
||||
```
|
||||
sudo swapoff -a; sudo swapon -a
|
||||
|
||||
```
|
||||
|
||||
|
||||
- Installing of programs in another drive
|
||||
|
||||
|
||||
[https://forums.linuxmint.com/viewtopic.php?t=361746](https://forums.linuxmint.com/viewtopic.php?t=361746)
|
||||
|
||||
```
|
||||
When you say "It automatically tries to install things to the ssd" - - is there a particular location to which these "things" are installing, or is it all over in different locations? I'm going to assume that it's not all in 1 location, and these installations land wherever is appropriate based on the particular installer. (Otherwise, you would have chosen the target location to install - right?)
|
||||
|
||||
Depending on how much money & effort you want to spend, I can suggest 4 options:
|
||||
|
||||
1. Replace your 15GB SSD with something larger, and then clone the 15GB onto that larger drive.
|
||||
This would be the easiest, assuming that you can make that swap. 15GB is nothing these days, and I'm honestly surprised that you were even able to get Mint to install on something that small. A 256GB can be had for around $50 or less these days, which would give you far more breathing room.
|
||||
|
||||
2. Resize & Repartition your 2TB drive and clone your 15GB into that space. This would be the cheapest option, if you could eke out a 256GB partition from your 2TB as a boot partition. It could be tricky, and I would highly recommend backing up anything important on that drive in case something gets mucked up during the operation...but if done right, you would end up booting directly from the 2TB, and wouldn't need that 15GB drive at all.
|
||||
|
||||
3. Create additional folders on the 2TB drive and mount them within your fstab into whatever directories on your / drive that need it most. This could be your /usr, /var, /etc, or even /home - depending on exactly which directories are being overloaded most. You'd then have to copy all data from your source 15GB drive folders (recursively, including subdirectories & permissions) to the respective new folder on the 2TB drive. This would be by far the most complex, and I wouldn't recommend it unless you have a good deal of experience working in the terminal along with a very good understanding of how Linux-like file systems work.
|
||||
|
||||
The fact is that unless your program is 100% self-contained with *all* of the dependencies in a single folder, you're likely to have bits & pieces installed in a variety of locations. You're not going to successfully move an application to a new location without going into each & every piece of that application to map out their relationship to one another, and adjusting accordingly. This would also permanently screw up your ability to update that application down the road. It is far better to either reinstall that app (if you have the ability to choose a target location) or to simply accept the program's structure and find a way to make space for it.
|
||||
|
||||
4. One other option - - depending on how much data you have/how much time you're willing to spend backing up or re-downloading - - re-install Mint directly onto that 2TB drive. This would be the cleanest option, and would avoid having to muck around with changing hardware around or playing with partitions. We don't know what programs & applications you have, or really anything at this point about your hardware & level of experience....but that would be the #1 thing to consider, in my opinion?
|
||||
```
|
||||
|
||||
- With Partition
|
||||
|
||||
Installing programs on another drive in Linux is possible, and it can be useful if you want to manage disk space efficiently or have specific storage requirements. The steps to achieve this may vary slightly depending on your Linux distribution, but the general process is as follows:
|
||||
|
||||
1. **Partition and Format the Drive:**
|
||||
If the drive is not already partitioned and formatted, you need to do that first. Use tools like **`fdisk`**, **`parted`**, or **`gparted`** to create a new partition on the drive and then format it with an appropriate file system like ext4.
|
||||
2. **Mount the Drive:**
|
||||
Once the drive is formatted, you need to mount it to a directory in your file system. Choose a suitable mount point, create a directory (if it doesn't already exist), and mount the new partition using the **`mount`** command. For example:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
sudo mount /dev/sdXY /mnt/my_new_drive
|
||||
|
||||
```
|
||||
|
||||
Replace **`/dev/sdXY`** with the correct partition identifier, and **`/mnt/my_new_drive`** with your chosen mount point.
|
||||
|
||||
3. **Configure the Fstab File (optional):**
|
||||
To mount the drive automatically at boot, you can add an entry to the **`/etc/fstab`** file. Open the file with a text editor (with root privileges) and add a line like this:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
/dev/sdXY /mnt/my_new_drive ext4 defaults 0 0
|
||||
|
||||
```
|
||||
|
||||
Again, replace **`/dev/sdXY`** and **`/mnt/my_new_drive`** with your partition and mount point.
|
||||
|
||||
4. **Install Programs to the New Drive:**
|
||||
When you install new programs, use the package manager of your distribution to specify the custom installation path on the new drive. For example, with **`apt`** (used in Debian-based systems), you can use the **`o`** option to set the installation path:
|
||||
|
||||
```arduino
|
||||
arduinoCopy code
|
||||
sudo apt-get install package_name -o dir::cache=/mnt/my_new_drive
|
||||
|
||||
```
|
||||
|
||||
This will install **`package_name`** on the specified path.
|
||||
|
||||
|
||||
Remember to adjust the commands according to your specific drive and mount point settings. Always be cautious when working with partitions and the filesystem, as it can lead to data loss if not done properly.
|
||||
|
||||
Additionally, if your intent is to move an already-installed program to another drive, it may be more complex and require additional steps depending on the application. In such cases, it is often simpler to reinstall the program with the custom installation path as described above.
|
||||
|
||||
- Without partition
|
||||
|
||||
Yes, you can install programs on another drive without creating a separate partition by using symbolic links or bind mounts. This method allows you to create a link from the original program directory to a directory on the other drive. This way, the program will appear to be installed on the primary drive, but its files will actually reside on the secondary drive.
|
||||
|
||||
Here's how you can do it using symbolic links or bind mounts:
|
||||
|
||||
**Symbolic Links:**
|
||||
|
||||
1. First, create a directory on the other drive where you want to store the program's files. For example:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
sudo mkdir /mnt/my_new_drive/my_programs
|
||||
|
||||
```
|
||||
|
||||
2. Next, install the program as you would normally do. Let's assume the program is installed in the default location, such as **`/usr/bin/my_program`**.
|
||||
3. Move the program's files to the directory on the other drive using **`mv`**:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
sudo mv /usr/bin/my_program /mnt/my_new_drive/my_programs/
|
||||
|
||||
```
|
||||
|
||||
4. Create a symbolic link from the original location to the new location on the other drive:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
sudo ln -s /mnt/my_new_drive/my_programs/my_program /usr/bin/my_program
|
||||
|
||||
```
|
||||
|
||||
|
||||
Now, when you run **`my_program`**, it will execute the program from the other drive even though the link is in the usual location.
|
||||
|
||||
**Bind Mounts:**
|
||||
|
||||
1. Create a directory on the other drive where you want to store the program's files, similar to the previous method.
|
||||
2. Install the program as usual.
|
||||
3. Instead of using symbolic links, you can mount the new directory over the original program directory using a bind mount. First, unmount the directory if it's already mounted:
|
||||
|
||||
```bash
|
||||
|
||||
sudo umount /usr/bin/my_program
|
||||
|
||||
```
|
||||
|
||||
4. Mount the new directory over the original program directory using the bind mount:
|
||||
|
||||
```bash
|
||||
|
||||
sudo mount --bind /mnt/my_new_drive/my_programs/my_program /usr/bin/my_program
|
||||
|
||||
```
|
||||
|
||||
5. Update the **`/etc/fstab`** file to ensure the bind mount is persistent across reboots. Add the following line:
|
||||
|
||||
```bash
|
||||
|
||||
/mnt/my_new_drive/my_programs/my_program /usr/bin/my_program none bind 0 0
|
||||
|
||||
```
|
||||
|
||||
|
||||
Remember to replace **`/mnt/my_new_drive/my_programs/my_program`** with the actual path to the program on the other drive.
|
||||
|
||||
Both methods achieve a similar outcome: installing the program on another drive without creating a separate partition. The symbolic link method is easier to set up, while bind mounts are more suitable for long-term and persistent use as they survive reboots.
|
||||
|
||||
- Battery drain
|
||||
|
||||
[https://fosspost.org/7-tips-to-reduce-battery-usage-on-linux/](https://fosspost.org/7-tips-to-reduce-battery-usage-on-linux/)
|
||||
|
||||
- Disabling peripherals
|
||||
|
||||
[https://askubuntu.com/questions/160945/is-there-a-way-to-disable-a-laptops-internal-keyboard](https://askubuntu.com/questions/160945/is-there-a-way-to-disable-a-laptops-internal-keyboard)
|
||||
|
||||
Sure, you can disable the internal keyboard on a Linux system while using an external keyboard. Here's a way to do it using the command line. Please note that you might need root (administrator) privileges to perform some of these actions.
|
||||
|
||||
1. **Identify the internal keyboard device:**
|
||||
|
||||
Open a terminal and enter the following command to list input devices:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
xinput list
|
||||
|
||||
```
|
||||
|
||||
Look for the entry corresponding to your internal keyboard. It will be listed along with its ID number.
|
||||
|
||||
2. **Disable the internal keyboard:**
|
||||
|
||||
Once you have identified the ID of your internal keyboard, you can use the following command to disable it:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
xinput float <internal_keyboard_id>
|
||||
|
||||
```
|
||||
|
||||
Replace **`<internal_keyboard_id>`** with the actual ID of your internal keyboard.
|
||||
|
||||
3. **Re-enable the internal keyboard:**
|
||||
|
||||
If you want to re-enable the internal keyboard later, you can use the following command:
|
||||
|
||||
```bash
|
||||
bashCopy code
|
||||
xinput reattach <internal_keyboard_id> <master_id>
|
||||
|
||||
```
|
||||
|
||||
Replace **`<internal_keyboard_id>`** with the ID of your internal keyboard and **`<master_id>`** with the ID of the master device (usually the external keyboard or a virtual core device).
|
||||
|
||||
|
||||
Please note that these changes will not persist across reboots. If you want the internal keyboard to remain disabled even after restarting your system, you might need to create a script that runs these commands during startup.
|
||||
|
||||
Remember that working with input devices can have implications, and disabling devices might lead to unexpected behaviors. Make sure you have a way to revert the changes if needed.
|
||||
|
||||
- Download manager
|
||||
|
||||
https://itsfoss.com/best-download-managers-linux/?fbclid=IwAR07vrVKSzaMZz5WNPo8KRjAA6VfX-bYPVnLe8IiU9Yi_YJ4wH0ZaijncZ8
|
||||
|
||||
- More apps
|
||||
|
||||
|
||||
https://itsfoss.com/best-ubuntu-apps/
|
||||
|
||||
https://www.geeksmint.com/awesome-linux-software/
|
||||
|
||||
- Cons of linux
|
||||
1. Consumes more battery because its drivers are not optimised as hardware firmwares are not open source but windows has a deal
|
||||
2. Audio and video driver are not that good
|
||||
3. hibernate is disabled by default
|
||||
4. no backward compatibility
|
||||
5. Not all softwares are available for Linux
|
||||
6. Fragmentation
|
||||
- Pirated gaming
|
||||
|
||||
Lutris
|
||||
|
||||
- lightweight distros
|
||||
|
||||
[https://itsfoss.com/lightweight-linux-beginners/#5-bodhi-linux](https://itsfoss.com/lightweight-linux-beginners/#5-bodhi-linux)
|
||||
|
||||
- Appimage
|
||||
|
||||
`chmod a+x <appimageFile>`
|
||||
|
||||
- Resizing partition
|
||||
|
||||
[https://www.youtube.com/watch?v=Kyz9x71gEPI](https://www.youtube.com/watch?v=Kyz9x71gEPI)
|
||||
|
||||
[https://e.pcloud.link/publink/show?code=XZWaeWZbzlFCCXrg0mX6XFcsNXvykHLqNkk](https://e.pcloud.link/publink/show?code=XZWaeWZbzlFCCXrg0mX6XFcsNXvykHLqNkk)
|
||||
|
||||
[https://sdrive.app/s/xnwhq1znzhn8kvyi3a9j71zo](https://sdrive.app/s/xnwhq1znzhn8kvyi3a9j71zo)
|
||||
|
||||
[https://files.sdrive.app/6e9bb95b-7524-437a-9c6e-54974f58b3fd.mp4](https://files.sdrive.app/6e9bb95b-7524-437a-9c6e-54974f58b3fd.mp4)
|
||||
|
||||
- WinRAR
|
||||
|
||||
[https://www.win-rar.com/download.html?&L=0](https://www.win-rar.com/download.html?&L=0)
|
||||
|
||||
You can extract a RAR file that is password protected on Linux with a utility called `unrar`
|
||||
|
||||
```
|
||||
1 sudo apt install unrar
|
||||
2
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
1 # provide a password with -p
|
||||
2 unrar e -pPASSWORD FILE.rar
|
||||
3
|
||||
|
||||
```
|
||||
|
||||
To just extract a file that has no password, only pass the `e` flag
|
||||
|
||||
```
|
||||
1 unrar e FILE.rar
|
||||
|
||||
```
|
||||
|
||||
[rarlinux-x64-623.tar.gz](../../_resources/rarlinux-x64-623.tar.gz)
|
||||
|
||||
- Portable firefox
|
||||
|
||||
[https://www.airaghi.net/en/2017/03/22/install-mozilla-firefox-portable-on-linux/](https://www.airaghi.net/en/2017/03/22/install-mozilla-firefox-portable-on-linux/)
|
||||
|
||||
- Recently installed
|
||||
1. docker images
|
||||
2. golang
|
||||
3. libsecret
|
||||
- Disable bluetooth on startup
|
||||
|
||||
For this ubuntu edit `/etc/bluetooth/main.conf` and find the line
|
||||
|
||||
```
|
||||
AutoEnable=true
|
||||
|
||||
```
|
||||
|
||||
and replace it with:
|
||||
|
||||
```
|
||||
AutoEnable=false
|
||||
```
|
||||
|
||||
- NordVpn
|
||||
|
||||
sign the key by downloading asc from
|
||||
|
||||
[https://repo.nordvpn.com/gpg/nordvpn_public.asc](https://repo.nordvpn.com/gpg/nordvpn_public.asc)
|
||||
|
||||
then
|
||||
|
||||
`sudo apt-key add nordvpn-public-key.asc`
|
||||
|
||||
`sudo nano /etc/apt/sources.list.d/nordvpn.list`
|
||||
|
||||
`deb [arch=amd64 signed-by=/usr/share/keyrings/nordvpn-archive-keyring.gpg]`
|
||||
|
||||
then download .deb file from here ‘[https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn_3.16.6_i386.deb](https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn_3.16.6_i386.deb)’
|
||||
|
||||
or
|
||||
|
||||
[https://file.lu/d/1noK](https://file.lu/d/1noK)
|
||||
|
||||
- Login
|
||||
- type `nordvpn login` into the cli
|
||||
- proceed through the browser
|
||||
- once you've logged in copy the link where it says "return to the app" (it should be something like `nordvpn://login` etc)
|
||||
- go back to cli and type `nordvpn login --callback "pasted-url-from-before"` (pay attention to quote the url!)
|
||||
- now you're logged in
|
||||
- connect
|
||||
|
||||
`nordvpn connect <country_name>` (no need of country code and server address)
|
||||
|
||||
- suspend/sleep
|
||||
|
||||
[https://askubuntu.com/questions/543921/authentication-required-before-suspend](https://askubuntu.com/questions/543921/authentication-required-before-suspend)
|
||||
|
||||
1. In command line run:
|
||||
|
||||
```
|
||||
locate -b org.freedesktop.login1.policy
|
||||
|
||||
```
|
||||
|
||||
The found file is
|
||||
|
||||
```
|
||||
/usr/share/polkit-1/actions/org.freedesktop.login1.policy
|
||||
|
||||
```
|
||||
|
||||
2. In the file, near line
|
||||
|
||||
```xml
|
||||
<action id="org.freedesktop.login1.suspend">
|
||||
|
||||
```
|
||||
|
||||
check these:
|
||||
|
||||
```xml
|
||||
<defaults>
|
||||
<allow_any>yes</allow_any>
|
||||
<allow_inactive>yes</allow_inactive>
|
||||
<allow_active>yes</allow_active>
|
||||
</defaults>
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue