initial
This commit is contained in:
commit
74ae93a96e
8 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
Fragmentation
|
||||
|
||||
- Answering to your question. Fragmentation occurs because sometimes when you allocate something in memory it doesn't occupy contigous memory cells, to understand it you could imagine a train with wagons. The information that you are putting in this train is getting in the wagons but not in a row, not in a contigous way. Now, since you have to manage memory using partitions you could find yourself with a single process scattered in different memory cells that are being partition edfor that process not leaving enough space for new processes. When you take the old process out of the memory, it doesn't automatically free the space it occupied (in some systems) and this causes fragmentation and memory leaks.
|
||||

|
||||
103
joplin notion extension/Web Development/Basics/Set 1.md
Normal file
103
joplin notion extension/Web Development/Basics/Set 1.md
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
Set 1
|
||||
|
||||
- Internet of Things
|
||||
The Internet of Things (IoT) describes the network of physical objects—“things”—that are embedded with sensors, software, and other technologies for the purpose of connecting and exchanging data with other devices and systems over the internet. Like smartwathes, sensors in machines, etc
|
||||
- Domain names
|
||||
gmail.com is domain name. org, .com are domain name extension or top level domain
|
||||
- http vs tcp
|
||||
TCP is the raw data transfer protocol, and http is the encoding sort of TCP manages the data stream, whereas HTTP describes what the data in the stream contains.
|
||||
So HTTP runs on top on TCP
|
||||
also
|
||||
IP indicates, among other information, which IP address a packet should go to (think of a mailing address), while TCP indicates which port a packet should go to at each IP address (think of the floor of a building or an apartment number).so ip address is IP and its port part is tcp.
|
||||
- Linux kernel
|
||||
https://www.youtube.com/watch?v=mycVSMyShk8
|
||||

|
||||
- IPv4 address
|
||||
https://www.digitalocean.com/community/tutorials/understanding-ip-addresses-subnets-and-cidr-notation-for-networking
|
||||
It is 32 bit address contains 4 octlets as each section os if 8 bits/1 byte.
|
||||
from 0.0.0.0 to 255.255.255.255 . so total nodes are 2^32
|
||||
eg
|
||||
`192.168.0.5`
|
||||
- IPv6 address
|
||||
It is 128 bit address that contains 8 segments of 4 hex digits
|
||||
`1203:8fe0:fe80:b897:8990:8a7c:99bf:323d`
|
||||
Compact version is allowed too means we can remove leading zeroes (0s from left)
|
||||
`8703:0087:0874:0000:76b1....`
|
||||
it can be written as
|
||||
`8703:87:874::76b1....`
|
||||
Compacting rule is that it can be decompressed back too. So this leading we r removing whole segment bcz of `0000` to `::` then this can be done only one time bcz
|
||||
`1203:8fe0:0000:b897:8990:0000:0000:323d`
|
||||
If delete whole segment 2 times then
|
||||
`1203:8fe0::b897:8990::323d`
|
||||
now in when decompressing it we dont know which side have how many segments. it can be either
|
||||
`1203:8fe0:0000:b897:8990:0000:0000:323d` (correct one)
|
||||
`1203:8fe0:0000:0000:b897:8990:0000:323d` (wrong one)
|
||||
- 2 types of ipv6 address in router
|
||||
https://www.quora.com/Why-do-I-have-2-different-IPv6-addresses-in-my-device
|
||||
starting with `fe80` whch ends with scope link is for local connection only and never go outside the subnet and other one dont start with `fe80` and send with scope global can be used for all the actual client communications you would expect to see out across the internet etc.
|
||||
- IPv4 Classes
|
||||
|
||||
- Class A : 0.0.0.0 to 127.255.255.255
|
||||
for large networks like ISPs
|
||||
- Class B : 128.0. 0.0 to 191.255. 255.255
|
||||
for medium networks like enterprise networks
|
||||
- Class C : 192.0.1.1 - 223.255.254.254
|
||||
for small networks ie LAN
|
||||
- Class D : 224.0.0.0 - 239.255.255.255
|
||||
for multicast addressing
|
||||
- Class E : 240.0.0.0 - 255.255.255.254
|
||||
for experimental purposes
|
||||
- Reserved IP address
|
||||
localhost ie loopback range is useful reserved address specified from `127.0.0.0` to `127.255.255.255`
|
||||
Each class have their own reserved private address
|
||||
- Class A : 10.0.0.0 to 10.255.255.255
|
||||
- Class B : 172.16.0.0 to 172.31.255.255
|
||||
- Class C : 192.168.0.0 to 192.168.255.255
|
||||
Their advantage is that if there is no internet then computer can use these private IPv4 address
|
||||
- Netmasks and Subnets
|
||||
Netmask is also called subnet mask
|
||||
The process of dividing a network into smaller network sections is called subnetting
|
||||
Each address space is divided into network and host potion. In class C ip `192.168.0.15` first 3 octlets like `192.168.0` is network and `15` is the host
|
||||
Subnetting is the process of dividing a single network into smaller subnetworks, each with its own network address and range of usable internet protocol (IP) addresses.
|
||||
Subnet mask is specification/config which contain how many bits are allocated to network portion. In case of home wifi router subnet is 24 means 3 octelts `192.168.0` and last one ie `15` is host one
|
||||
Subnet /24 means 3 oclets of network portion so it can be represented as `255.255.255.0` 0 represents host section and (255) with base 10/11111111 with base 2 represents network section
|
||||
- Calculating network portion and host portion with subnet
|
||||
Using Bitwise AND.
|
||||
In `255.255.255.0` the first 24 bits are 1 and others r 0 so when operated with `192.168.0.15` then first 3 octlets will be come as of network portion and rest host portion bcz
|
||||
1.1=1
|
||||
1.0=0
|
||||
1.X=X
|
||||
0.X=0
|
||||
0 and 255 host are reserved so they cant be used so that leave us with 254 hosts.
|
||||
|
||||
Note : Wifi router can connect upto 250 devices so a single IP will connect to 250 devices. Other than 0 and 255 4 more r reserved bcz of mesh network maybe
|
||||
for wifi router
|
||||
subnet mask for ipv6 address in wifi router is /64 means first half of network section, rest for host section
|
||||
- Subnetting
|
||||
If we have subnet mask `255.255.255.0` and if we wanna divide our host portion into 2 parts then use the first bit for that thus dividing them into 128 and 128.
|
||||
From
|
||||
`1111 1111 1111 0000-0000`
|
||||
To
|
||||
`1111-1111 1111-1111 1111-1111 1000-0000`
|
||||
So The ipv4 address is `192.168.0.128` used a divider. Now we have 2 subnetworks.
|
||||
First subnetworks from `192.168.0.1` to `192.168.0.127`
|
||||
Second subnetworks from `192.168.0.129` to `192.168.0.255`
|
||||
This happened after using 1 bit of host portion. If used more bits then more subnetting is possible.
|
||||
- CIDR Notation
|
||||
A system called 'Classless Inter-Domain Routing' or CIDR is alternative to traditional subnetting
|
||||
Instead of using traditional subnetting which has a fixed netmask like in router it is `255.255.255.0` we can have our own specification of allocation of network and host section of ip address. We can use this `192.168.0.15/24` (CIDR notation) which means ip address is `192.168.0.15` and 24 bits for network and rest 8 for host.
|
||||
We can change this to `192.168.0.15/23`. Now we can have ineresting IP addresses like range from `192.168.0.0` to `192.168.0.255` and `192.168.1.0` to `192.168.1.255` so total of 512 hosts
|
||||
- Nginx, traefik, istio, linkerd, consul etc are called ingresses and service meshes
|
||||
|
||||
|
||||
- how vpn transports http traffic
|
||||
1. Your browser sends HTTP traffic (which uses TCP).
|
||||
2. The VPN software wraps (encapsulates) that TCP packet.
|
||||
3. The encapsulated packet is sent to the VPN server using UDP.
|
||||
4. The VPN server unwraps it and forwards the original HTTP request to the website.
|
||||
5. The response comes back the same way.
|
||||
|
||||
|
||||
http codes
|
||||
- https://www.dotcom-monitor.com/blog/the-10-most-common-http-status-codes/
|
||||
[90 Common HTTP Status Codes_ Full Reference _ Triage (2_9_2026 5_39_44 pm).u.zip.html](../../../_resources/90%20Common%20HTTP%20Status%20Codes_%20Full%20Reference%20_%20Tria.html)
|
||||
60
joplin notion extension/Web Development/Basics/Theory.md
Normal file
60
joplin notion extension/Web Development/Basics/Theory.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
Theory
|
||||
|
||||
1_WHAT IS STORAGE VIRTUALIZATION?
|
||||
|
||||
|
||||
Storage virtualization is the pooling of physical storage from multiple storage devices into what appears to be a single storage device -- or pool of available storage capacity. A central console manages the storage.
|
||||
|
||||
|
||||
2_WHAT REALLY IS STORAGE VIRTUALIZATION?
|
||||
|
||||
storage virtualization is when you take multiple physical storage devices and combine them to make one, or multiple "virtual" storage devices with the storage capacity to meet your needs
|
||||
|
||||
|
||||
|
||||
3_WHAT DOES STORAGE VIRTUALIZATION DO?
|
||||
|
||||
|
||||
so lets say you work IT at a hospital, and you got 500 different computers each with 1TB of hard drive space each, and they are all connected, controlled, and managed by an internal hospital IT network, and your the IT network guy.
|
||||
|
||||
now, all those hard drives are being used, each employee with a computer has their operating system installed, and their own personal work files, which means that each hard drive is going to have a different amount of space left on the hard drive, some might have 900GB of data left, some 500GB, some 200GB, but each and everyone one has a different amount of storage space.
|
||||
|
||||
now lets say, you as the network IT guy, wanted to create a storage space, out of 1GB, of all the hard drives you have access to, so you wanted to go into each employees computer, and borrow 1GB from each computer, and create a storage space out of all those 1GB's, you borrowed, totalling a drive of 500GB,
|
||||
|
||||
with storage virtualization you can do exactly that, you can take separate physical storage devices, you can take all of the storage space they have or only a part, and create a virtual storage device
|
||||
|
||||
|
||||
|
||||
Transpiling
|
||||
It is often called 'transpiling', when you translate code with JS-preprocessors like CoffeeScript, TypeScript (you name it) to plain JavaScript.
|
||||
Whereas compiling and interpreter converts code into machine language
|
||||
|
||||
CI/CD
|
||||
- pull code from git repo, build it and deploy it, these are done by scripts
|
||||
|
||||
|
||||
**Kernal,GNU**
|
||||
- Think of GNU as a set of tools, kind of like Microsoft Office is a set of programs.
|
||||
The design of the Linux filesystem (treating everything as a file or directory) is a choice made for the Kernel, and programs that want to have any chance of running need to adhere to the Kernel
|
||||
- filesystem : So we have a storage device, this could be a HDD or SDD that a computer can write data to.
|
||||
Ontop of that we have firmware that sits on said physical device, this is rarely updated as it's very simple and straightforward
|
||||
Above this we have the driver for the computer. This provides a standardized manner in which the operating system can read and write to the storage device.
|
||||
|
||||
The OS uses partitions to segment out where data can go. The format of data ontop of a partition varies, being something like NTFS, FAT32, ext4, btrfs, APFS, ZFS etc.
|
||||
|
||||
The "filesystem" can refer to one of two things:
|
||||
1. The actual formatting of how the OS reads the partition for data. ext4 and btrfs work by using something called `inodes` that define basic metadata about a file and the start and end of it's payload... So if you lose the inode you basically lose the file
|
||||
2. General interfacing with a formatted partition
|
||||
e.g. interfacing with the filesystem
|
||||
3. metadata is a common term for data providing information about one or more other pieces of data, when inode is a type of metadata that stores basic information about a regular file, directory, or other file system object.
|
||||
4. The kernel is kind of like the nervous system of a human, it does a lot of control and operation of the low-level functionality.
|
||||
The two common Kernel interfaces are as a filesystem (How linux and unix work) of via APIs (Windows 🤢)
|
||||
Any command you enter on a PTY first asks the kernel to start a new task (process) with some given parameters. It locates the executable and creates a new process passing the parameters that were provided. It bill bind an input and output stream (stdin/stderr/stdout) etc and let the program access sockets and whatever else based on permissions defined for the executor of the program and the program itself
|
||||
5. "space" refers to the execution of a program.
|
||||
If something runs in "kernel" space that means it's running under the operating system. If it runs in "user" space that means it runs for a particular user"
|
||||
|
||||
Think of it like this: Nano runs for user `robin` and xorg runs for user `root`
|
||||
The init system controls the root process, and which `user` owns it. I'm not really an expert on this so take my explanation with a grain of salt
|
||||
per a stackoverflow thread, a program run by the root user runs in user mode and switches to kernel mode when needed and then back to user mode (it goes back and forth)
|
||||
source : https://stackoverflow.com/questions/2354125/difference-between-processes-running-in-
|
||||

|
||||
73
joplin notion extension/Web Development/Basics/Tor.md
Normal file
73
joplin notion extension/Web Development/Basics/Tor.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
Tor (The Onion Router)
|
||||
https://www.linkedin.com/pulse/what-does-happen-inside-tor-network-how-work-arun-kl
|
||||
tor_anonymity_expert_guide.mp4 https://files.catbox.moe/dqk06e.mp4
|
||||
|
||||
https://www.reddit.com/r/explainlikeimfive/comments/c5sw4b/eli5_what_is_a_tor_browser_how_does_it_work_and/
|
||||
|
||||
- Let's use a mail analogy. Let's say you want to send an anonymous love letter to someone named Alice. You don't want Alice to know it was you who sent it, and you'd prefer not to let anyone else know you have a crush on Alice either.
|
||||
|
||||
Using a standard browser is like handing your letter directly to Alice. Obviously not going to work.
|
||||
|
||||
Fortunately, there are thousands of strangers who volunteer to run a love letter anonymization network. Out of the thousands of strangers, you randomly select three of them. Let's call them stranger #1, #2, #3.
|
||||
|
||||
So here's what you do: Take your letter addressed to Alice. Place it in an envelope, addressed to stranger #3. And put that envelope into another one addressed to stranger #2, and finally another one addressed to stranger #1.
|
||||
|
||||
Now deliver the envelope to stranger #1. Stranger #1 opens it and finds the envelope addressed to stranger #2, which he delivers accordingly. Stranger #2 opens the next envelope, finding and delivering the envelope addressed to stranger #3. Stranger #3 opens it, finding the letter addressed to Alice, and delivers it to Alice. Since it is illegal to open an envelope not addressed to you, each stranger can only open up one layer. (In Tor, this is cryptographically enforced with math, not postal law.)
|
||||
|
||||
So what's the final result? Stranger #1 knows who sent the letter, but not its contents nor its ultimate destination. Stranger #2 knows neither who sent it, nor the contents, nor the destination. Stranger #3 knows the contents, but not who sent it. Alice also knows the contents but not who sent it. Thus anonymity is achieved: nobody other than you knows both the contents and the sender.
|
||||
|
||||
So that's Tor in a nutshell. There's also a lot of confusion out there about the differences between Tor and VPN. In this analogy, a VPN is like handing your letter to a trusted friend who hands it to Alice. Your friend is in a position of being able to know both contents and sender, so you're putting a lot of faith in your friend (VPN) to not rat you out. But it has the advantage of not letting a stranger (stranger #3) read your letter, and it's simpler with less hops making a VPN more suitable for daily browsing.
|
||||
- Volunteers who host the tor nodes are normally belong to privacy respecting organisation , countries or universities to avoid legal trouble. There r some nodes which r controlled by FBI, NSA and law enforcement to catch criminals too
|
||||
- Understanding techinically
|
||||
to access hidden service of tor when someone visit the onion site it checks with tor database for introduction point then tor magic applies ie relaying through 3 different nodes which r randomly selected and finally it reaches the introduction point. From Introduction point to hidden site again tor magic/circuit happens ie relaying through 3 different nodes then data comes to hidden service right
|
||||
- i2p : like tor there is another one ie i2p. tor has clear net access means any surface web contents like google.com can be accessed and also tor network like onion . in case of i2p only i2p network can be accessed. Also i2p is faster
|
||||
one interesting part is, packages in the i2p network change sizes, which makes it more harder to track and fingerprint
|
||||
tor has registry server for nodes and if that goes down then it would be disaster. Though chances r less bc it is mainatined by tor project. i2p is p2p and is more decentralized than tor
|
||||
|
||||
|
||||
|
||||
## hosting sites in tor
|
||||
https://infosecwriteups.com/hosting-tor-website-on-dark-web-the-safe-way-9890d1947b6a
|
||||
- Installing tor
|
||||
`yay -S tor tor-browser`
|
||||
- In `etc/tor/torrc`
|
||||
Uncomment following
|
||||

|
||||
HiddenServicePort 80 127.0.0.1:PORT. It can be any port number wherever site is hosted in localhost. But 80 must be the one other localhost request will be redirected else site wont run
|
||||
Another error can be faced
|
||||

|
||||
Sometimes this 9050 PORT may not be available so u can change that too
|
||||
- Then finally `sudo tor` anywhere. Make sure run it as root. or use `systemctl start tor`
|
||||
- To get another domain just change the hidden service name
|
||||
In `/etc/tor/torrc`
|
||||
It can be
|
||||
`HiddenServiceDir /var/lib/tor/mysite/` too. Now u will get another onion site tooo start as a `tor` user instead of `root` user
|
||||
- Separate config file
|
||||
U can have a separate orrc file too anywhere in user directory too like `~/.torrc` too
|
||||
Use `tor -f ~/.torrc` to start tor wtith different config
|
||||
- Multiple services running simuntaneouly
|
||||
In torrc file
|
||||
```bash
|
||||
HiddenServiceDir /var/lib/tor/mysite/
|
||||
HiddenServicePort 80 127.0.0.1:20108
|
||||
|
||||
HiddenServiceDir /var/lib/tor/hidden_service/
|
||||
HiddenServicePort 80 127.0.0.1:20100
|
||||
|
||||
```
|
||||
- Starting tor as non root aka as a tor username
|
||||
Starting tor as root can have some security issues
|
||||
`systemctl start tor` is a good way of doing that to start as a tor user instead or root
|
||||
But if we want more customizationa and not stick to default then we can have different torrc file but make sure it is in `etc/tor` directory like `/etc/tor/torrc2`
|
||||
By default config file is set as `/etc/tor/torrc` so to change it we need to edit `/usr/lib/systemd/system/tor.service` file. Its syslink is created when we enable this service at `/etc/systemd/system/multi-user.target.wants/tor.service`,
|
||||
Change it like this
|
||||
```text
|
||||
ExecStartPre=/usr/bin/tor -f /etc/tor/torrc2 --verify-config
|
||||
ExecStart=/usr/bin/tor -f /etc/tor/torrc2
|
||||
```
|
||||
Then to apply changes reload systemctl by
|
||||
`systemctl daemon-reload`
|
||||
and finally restart tor service
|
||||
`systemctl restart tor`
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
certificates
|
||||
|
||||
when we connect to site like github.com it is not a direct connection to github IP, there are so many entries in the middle like router,isp and many route nodes. if any of these entries is compromised then man in the middle attack can take place
|
||||
|
||||
1. dns spoofing : github.com will now lead to another IP. can happen when router or isp is compromised
|
||||
2. arp (address resolution protocol) spoofing : arp maps ipv4 to mac address. this happens in public wifi usually and shared network. attacker will send signal and claim to be router and it will claim victim device to router so now every information will route through attacker device
|
||||
3. ssl/tls stripping. related to 2nd one and in this downgrading security to http.
|
||||
|
||||
Now a trusted certificates can prevent these attacks by giving a identity to all the sites so impersonation becomes impossible. browsers have a list of root CAs (Certificate Authority)which gives mapping of public keys to sites. so lets say public key is 'AAA' and site is github.com and signed by digicert and if man in the middle attack take place then he will never have this public key 'AAA' signed by digicert. (Note: there can me multiple keys ofc but those need to be signed by that CA) so he in case of dns spoofing the wrong ip will have invalid cerificate, connection wont be extablished to impoersonation one ever bcz certificates wont be valid ever.
|
||||
|
||||
What if CA is comprmised by weak private key?
|
||||
then an attacker can generate certificate for his and compormised isp or router can impersonate them by generating certificates using the leaked private key.
|
||||
|
||||
|
||||
9
joplin notion extension/Web Development/Basics/others.md
Normal file
9
joplin notion extension/Web Development/Basics/others.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
others
|
||||
|
||||
- licenses
|
||||
https://www.gnu.org/licenses/license-list.en.html
|
||||
- **gpl** : all derieved work must be of gpl license and thus open source . it is a copyleft license
|
||||
**agpl** : for server side apps mainly means only frontend but backend is to be open source too. it is extension of gpl
|
||||
**lgp**l : it is bridge between mit and gpl and is weak copyleft license. it is used for libraries mainly so that people dont have to disclose whole program just bcz for using libraries but any modification done on that library must be released.
|
||||
- mit,bsd : permissive license and anyone can do whatever they want with it but have to mention that it is fork of the project and mention contributors
|
||||
-
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
sample apps
|
||||
|
||||
gui
|
||||
|
||||
Java
|
||||
[java gui.7z](../../../_resources/java%20gui.7z)
|
||||
|
||||
c++
|
||||
[cpp imgui.7z](../../../_resources/cpp%20imgui.7z)
|
||||
|
||||
go
|
||||
fyne
|
||||
[go fyne gui.7z](../../../_resources/go%20fyne%20gui.7z)
|
||||
andlabs
|
||||
[go andlabs gui.7z](../../../_resources/go%20andlabs%20gui.7z)
|
||||
wails
|
||||
[go wails gui.7z](../../../_resources/go%20wails%20gui.7z)
|
||||
|
||||
android
|
||||
[android java app.7z](../../../_resources/android%20java%20app.7z)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
sample codes
|
||||
|
||||
rust
|
||||
|
||||
building
|
||||
`cargo build --release`
|
||||
simply run
|
||||
`cargo run`
|
||||
Loading…
Reference in a new issue