TIL 2021
29 Jul 2021
Mon Dec 13 2021
rel=preconnect
in<link>
tag - setup process completed beforehand, resources loaded more quickly
Example -<link rel="preconnect" href="https://fonts.googleapis.com">
Sun Nov 21 2021
.npy
files => NumPy data store files, load faster. Blog
Fri Nov 12 2021
- Port 53 => DNS server listens for requests
Sun Oct 31 2021
- Go to
sheets.new
ordocs.new
for new Google sheet/doc. - Kernel module - object file that can be loaded and unloaded at any time to extend kernel functionality at runtime.
- Loaded in
/proc/modules
- Most device drivers are used as kernel modules
lsmod
=> List loaded kernel modules (trivial, only lists/proc/modules
)
- Loaded in
- ALSA - group of in-built kernel modules and also user space library for application development.
- PulseAudio - Audio server (like Xorg).
- Avahi - service publishing and discovery in a (local) network.
Thu Oct 21 2021
- x87
- floating-point related subset of the x86 instruction set
- originally in extension chips to x86 Intel chips, now implemented in the chips itself
- microcode (higher level machine code implemented in hardware) implemetations of common numeric tasks.
- InputCoordinationTransformation
- Coordinates of mouse pointer multiplied with transformation matrix that is identity matrix by default. If the coordinates are (400, 197)
โก 1 0 0 โค โก 400 โค โก 400 โค โ 0 1 0 โฅ ยท โ 197 โฅ = โ 197 โฅ โฃ 0 0 1 โฆ โฃ 1 โฆ โฃ 1 โฆ
- To increase mouse speed =>
xinput set-prop <id> "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1
. Can be used to rotate direction also.
Tue Oct 19 2021
- kworker process - placeholder process for kernel worker threads, which perform most of the actual processing for the kernel, especially in cases where there are interrupts, timers, I/O, etc. These typically correspond to the vast majority of any allocated “system” time to running processes. https://askubuntu.com/questions/33640/kworker-what-is-it-and-why-is-it-hogging-so-much-cpu
Sun Oct 17 2021
- Pretty print CSV file on CLI
- https://www.stefaanlippens.net/pretty-csv.html
cat results.csv | column -t -s, | less -S
less -S
=> pager (:q etc)
Mon Oct 11 2021
- Frozen modules in Python => Python code is compiled into a code object, marshalled into a file and added to the Pyrhon executable
- Frozen because they implement the core of the
import
functionality, and cannot be loaded like any other modules. Must be done when the interpreter boots up.
- Frozen because they implement the core of the
Tue Oct 05 2021
Wed Sep 29 2021
- Memory thrashing
- More space alloted in virtual memory than physical memory in RAM.
- For a process, CPU spends more time doing swaps in and out of memory than execution, less productive work.
Tue Sep 28 2021
Ctrl+K F
=> Close folder in VS Code..S
files => Assembly code that needs to pass through preprocessor.s
file => can be directly compiled to objects- https://stackoverflow.com/a/51110745/11847988
Mon Sep 27 2021
iostat
- reports CPU utilization and IO stats for devices and filesystems.- File system fragmentation - File system stores files non-continuously
- increases seek time and disk head movement in HDDs
- Less of a problem in SSDs
- Consumer behavior thread
- Pain of Paying - Thought of money creates sensation of pain
- Membership cards, putting in terms of percentages, etc.
- Loss aversion theory - losing something makes us 2X unhappy, when gaining it makes us 1X happy.
- Pain of Paying - Thought of money creates sensation of pain
Thu Sep 23 2021
- Microarchitecture - hardware implementation of ISA, blueprint, also called “family” of CPUs.
Wed Sep 22 2021
- kernel configuration files in
/boot
uname -v
-> kernel release version
Tue Sep 21 2021
locate --basename '<dir name>'
=> find folder.kernel.perf_event_paranoid
=> kernel setting about how paranoid the kernel has to be about unpriviledged users accesing CPU event information.
Mon Sep 20 2021
-
- The
ptrace
system call provides a means by which one process (the “tracer”) may observe and control the execution of another process (the “tracee”), and examine and change the tracee’s memory and registers.
- The
-
Yama - security module that collects system-wide DAC security protections not handled by kernel.
- restricts scope of
ptrace
system call. - to remove restriction for ptrace:
sudo sysctl -w kernel.yama.ptrace_scope=0
- restricts scope of
-
kptr_restrict - This toggle indicates whether restrictions are placed on exposing kernel addresses via /proc and other interfaces. When kptr_restrict is set to (0), the default, there are no restrictions.
-
sysctl
=> configuring aspects of the kernel at runtime -
Discretionary Access Control (DAC) - Each object has an owner, initial owner is the one who created the file.
Mon Sep 13 2021
- Dunbar’s number
- cognitive limit to the number of people with whom one can maintain stable social relationships
Sat Sep 11 2021
- Chrome Omnibox -> Searching specific sites directly in the address bar by pressing
TAB
https://www.wired.com/2013/09/h2-chrome-omnibox/
Thu Sep 09 2021
docker-compose up -d
-> detached mode, starts services in background https://docs.docker.com/compose/reference/up/- Stop container auto restart =>
docker update --restart=no <my-container>
- To open workspace in VS Code from CLI, open the
.workspace
file. Folder opens automatically.
Sun Sep 05 2021
- MNIST dataset - images of handwritten digits
- FPGA (Field Programmable Gate Array) - IC that can be customized by user after manufacturing.
- In between ASIC and general purpose processors in terms of customizability.
Fri Sep 03 2021
- Significance map encoding -> Encodes floating point zero to one bit zero and floating point non-zero value into one-bit one value followed by original floating point non-zero value.
- Spandrel - a trait that did not evolve as a product of adaptive natural selection, but as a byproduct of evolution of some other characteristic.
Wed Sep 01 2021
- Anhedonia - Inability to feel pleasure
Sat Aug 28 2021
- FLOPS - floating point operation, unit of computation
- petaflops/s-day - performing 10^15 neural net operations per second for one day, or a total of about 10^20 operations.
Tue Aug 17 2021
- PE ratio - price to earnings ratio
- Market value per share / Earnings per share
- Earnings per share = Company’s profit / total no. of common shares
- High PE ratio means that the stock is overvalued or that investors are expecting high growth rate in the future.
- https://www.investopedia.com/terms/p/price-earningsratio.asp
Mon Aug 16 2021
- Quine program - self-reproducing program (outputs its own source code)
Sun Aug 15 2021
Thu Aug 05 2021
Sat Jul 31 2021
- Neuroplasticity(learning)
- noradrenaline secreted in states of urgency, enhances creation and retrieval of memory
- learning in adults -> urgency(noradrenaline) + focus(acetylcholine) -> followed by rest, decompression.
- dopamine reduces noradrenaline secretion -> feel less anxious, can go on longer without feeling tired.
- People tend to reach for phones/cigarettes/alcohol (things that release dopamine) when stressed/anxious.
Fri Jul 30 2021
sshfs
=> tool to mount remote filesystem locally via SSH- https://www.redhat.com/sysadmin/sshfs
sshfs user@host:/path/to/folder /path/to/mountpoint
- Unmount =>
fusermount -u /path/to/mountpoint
Thu Jul 29 2021
- Launch shell into running container
docker exec -it <container-id> /bin/bash
- prisma => ORM for Node.js
Sat Jul 24 2021
- tracemalloc - inbuilt Python module - trace memory allocations in Python
- pickle - serialize and deserialize Python object structure
- Serialization - Conversion to a byte stream, Deserialization - reverse process
- marshal - More primitive serialization than pickle, used for .pyc files.
- Freezing in python - Creating executable that can be run on Unix systems. In a nutshell, it creates a portable version of a python script that carries its own built in interpreter (basically like a binary executable), so that you can run it on machines without python.
Thu Jul 22 2021
- We can add meta tags with name “robot” to control how search engines index the webpage. Instructions are entered in the “content” attribute.
- Press
t
in GitHub repo => File finder
Tue Jul 06 2021
- Levenshtein distance
- Used in fuzzy search
- “Edit distance” between two strings
Sun Jul 04 2021
- Non-technical interviews
- Write down experiences in your past.
- Note down keywords.
- Note lines along which questions can be asked.
Thu Jun 10 2021
- Status code 204 => empty response
Wed Jun 09 2021
x86_64
==amd64
- Linux LVM
- LVM => Logical Volume management. Create logical volumes instead of disk partitions. Mount these onto file system like regular disk partitions.
Sat Jun 05 2021
tee
command in Linux. Reads from standard input and writes to both stdout and one or more files at the same time.<command> | tee file1.out file2.out file3.out
Thu May 27 2021
TigerVNC
is a client to connect to a VNC server.x11vnc
=> server.
Mon May 17 2021
- Modern implementation of Xorg doesn’t require a config file (
xorg.conf
). Configuration is done automatically. Can be created for customization. .conf
file added to/etc/X11/xorg.conf.d
to override default configurations.- evdev- generic device driver.
xinput get-button-mapping
=> shows a list of space separated integers that correspond to the physical buttons on the device.
Sun May 16 2021
- X11 specifies a mechanism for different clients to communicate with the server. Clients must adhere to certain conventions for inter-client communication.
- An application will own the current selection. When the data is to be pasted, a request is sent to the X server. This request is then referred to the client that owns that selection.
- Qt and GTK are window toolkits that are used to create GUIs. Have to interact with the display server and follow its guidelines.
Sat May 15 2021
- VPC - Virtual private cloud in AWS.
- Alacritty terminal
- Terraform
- https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest
- Used to deploy vpc
- Amazon machine image (AMI)
- AWS co-pilot
Thu May 13 2021
- Functions can be used as keys in dictionaries
- X Window System (X11 or simply X) etc
- Provides framework for drawing windows on display and interaction with mouse and keyboard. Basically a protocol. (X11 IS A PROTOCOL)
- https://en.wikipedia.org/wiki/Windowing_system##Display_server Server implements this protocol. Primary task is to coordinate input and output of clients. Talks to the kernel.
- Window manager controls the placement and appearance of application windows (e.g. i3wm is a tiling window manager). A desktop environment like GNOME, Xfce include a window manager along with applications such as file explorer, terminal emulator with consistent design and icons.
- https://askubuntu.com/questions/7881/what-is-the-x-server
- X is an application that manages one or more graphics displays and one or more input devices (keyboard, mouse, etc.) connected to the computer.
- A common component used with X server is the window manager
- https://en.wikipedia.org/wiki/X_Window_System_core_protocol
- X.org is an open source implementation of the X Window System.
xlsclients
- shows all the currently connected clients to the server.
- Two different ways to copy -
- clipboard - when you do
Ctrl+C
. You can edit this by running the commandxclipboard
. - X selection- when text is selected in the X window system. Pasted using middle click or
Shift+Insert
. Can be edited using thexsel
.
- clipboard - when you do
Wed May 12 2021
- https://www.gwern.net/lement
- Complementary products (fuel to cars, operating systems to processors)
- Price of your complementary products goes down => price of your product goes up.
- Try to commoditize your complementary product
Fri May 07 2021
- defaultdict in collections module Python
- takes function (default_factory) as argument
- function returns the default value that should be the value of an absent key
- If not present, that key value pair is inserted.
>>> from collections import defaultdict >>> my_dict = defaultdict(lambda: 0) >>> my_dict[1] 0 >>> my_dict defaultdict(<function <lambda> at 0x7fa5eeb7c700>, {1: 0}) >>> my_dict[18297] 0 >>> my_dict defaultdict(<function <lambda> at 0x7fa5eeb7c700>, {1: 0, 18297: 0})
Thu May 06 2021
- BIOS performs hardware initialization during boot. Hardware used by OS during runtime. Comes preinstalled with hardware. First program to run when powered on.
- BIOS is a firmware (low level software that controls harware).
- Earlier used to be on ROM, now on flash memory.
- UEFI is the successor to BIOS. UEFI uses C, wheras BIOS was written in Assembly
- https://www.ionos.com/digitalguide/server/configuration/what-is-a-bootloader/
- Linux file permissions https://linuxhandbook.com/linux-file-permissions/
Tue May 04 2021
- Idiomatic programming - using statements that are unique to that particular language.
Sun 25 Apr 2021
- “Vanilla” is used in general to refer to things that are plain and ordinary.
- chmod xxx => three BCD for three different permissions
Thu 15 Apr 2021
- If two objects refer to the same in-memory object, the
is
operator yieldsTrue
. - Strings are ‘interned’ in Python.
Wed 14 Apr 2021
- Regression to mean
- Ex: If a business organisation has a highly profitable quarter, despite the underlying reasons for its performance being unchanged, it is likely to do less well the next quarter.
- Not a causal phenomenon. It is based in a natural distribution about a mean.
Mon 12 Apr 2021
- l1d cache - level 1 data cache
- l1i cache - level 1 instruction cache
Tue 06 Apr 2021
- Cursor in databases is what an iterator is in a programming language.
Tue 06 Apr 2021
- PostgreSQL uses one process per connection. MySQL, on the other hand uses one thread per connection. https://rbranson.medium.com/10-things-i-hate-about-postgresql-20dbab8c2791