Skip to content

Instantly share code, notes, and snippets.

View 1solation's full-sized avatar
💻
Computer says no

Hasib Ahmed 1solation

💻
Computer says no
View GitHub Profile
{
"quotes": [
"Don't worry about what anybody else is going to do. The best way to\npredict the future is to invent it.\n-- Alan Kay\n",
"Premature optimization is the root of all evil (or at least most of it)\nin programming.\n-- Donald Knuth\n",
"Lisp has jokingly been called \"the most intelligent way to misuse a\ncomputer\". I think that description is a great compliment because it\ntransmits the full flavor of liberation: it has assisted a number of our\nmost gifted fellow humans in thinking previously impossible thoughts.\n-- Edsger Dijkstra, CACM, 15:10\n",
"Keep away from people who try to belittle your ambitions. Small people\nalways do that, but the really great make you feel that you, too, can\nbecome great.\n-- Mark Twain\n",
"What Paul does, and does very well, is to take ideas and concepts that\nare beautiful in the abstract, and brings them down to a real world\nlevel. That's a rare talent to find in writing these days.\n-- Jeff \"hemos\" Bates, D
@1solation
1solation / wsl-ram-eating-fix.md
Last active October 18, 2022 09:48
Fix WSL2 eating RAM with a .wslconfig

Fix WSL2 eating RAM

Make a .wslconfig file in your C:\Users\username folder. In this file you can set mulitple parameters, see following options:

[wsl2]
kernel=              # An absolute Windows path to a custom Linux kernel.
memory=              # How much memory to assign to the WSL2 VM.
processors= # How many processors to assign to the WSL2 VM.
@1solation
1solation / list_top_file_space_usage.md
Created January 25, 2022 23:00
List top 5 directories eating up disk space in your current working directory

List top 5 directories eating up disk space in your current working directory, human-readable format

du -hs * | sort -rh | head -5

Explained

  1. du command: Estimate file space usage.
  2. -h : Print sizes in human-readable format (e.g. 1.5G).
  3. -s : Display only a total for each argument.
  4. sort command : sort lines of text files.
@1solation
1solation / fix-mac-git-timeout-issue.md
Last active September 29, 2022 17:39
fix macbook ssh to github timeout issue

% ssh -T git@github.com

ssh: connect to host github.com port 22: Operation timed out

% vi ~/.ssh/config

add the following to the config file

# allows git ssh
@1solation
1solation / fix_failing_vscode_update_macos.md
Created November 8, 2022 17:45
vs code fails to update fix MacOS

VS Code fails to update

If VS Code doesn't update correctly once it restarts (with auto-updates enabled), it may be quarantined by macOS.

Option 1:

  • Move Code out of Downloads and into the Applications folder.

If option 1 doesn't work & fix VS Code's failed update

@1solation
1solation / vs-code-background.md
Last active November 23, 2022 22:03
backgrounds to spice up VS code

download the extension called background, extension ID: shalldie.background, on VS code.

This is what it will look like:

image

Copy the following inside your settings.json:

@1solation
1solation / mermaid-test.md
Created December 1, 2022 12:33
test mermaid diagram
sequenceDiagram;
Alice ->> Bob: Hello Bob, how are you?;
Bob-->>John: How about you John?;
Bob--x Alice: I am good thanks!;
Bob-x John: I am good thanks!;
Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.;

Bob-->Alice: Checking with John...;
Alice-&gt;John: Yes... John, how are you?;
@1solation
1solation / binsearch.js
Created December 19, 2022 17:35
coding problem - binary search function in JS, with comments
function binary_search(x, sorted_collection, low = 0, high = null) {
// x is target
// sorted_collection I will assume is always sorted in ascending numerical order AND starting from 1
// low is the start index
// high is the end index
if (high === null) {
high = sorted_collection.length; // using .length will return 1 index higher as arrays start with a 0 index, not 1
} else if (high < 0) {
throw new RangeError("High index out of range");
}
@1solation
1solation / binsearch_fixed.js
Created December 19, 2022 17:51
coding solution - binary search function in JS, with comments
function binary_search(x, sorted_collection, low = 0, high = null) {
// x is target
// sorted_collection I will assume is always sorted in ascending numerical order AND starting from 1, due to the test cases
// low is the start index
// high is the end index
// initialise high to the last index of the array if it's not provided
if (high === null) {
high = sorted_collection.length - 1; // setting high as highest index, which start from 0 not 1 (hence the -1)
} else if (high < 0) {
throw new RangeError("High index out of range");
@1solation
1solation / numToString.js
Created February 20, 2023 12:40
numToString.js
for (let i = 1; i <= 100; i++) {
let numString;
switch (i) {
case 1:
numString = "one";
break;
case 2:
numString = "two";
break;
case 3: