Skip to content

Instantly share code, notes, and snippets.

@Giwan
Giwan / vscode.md
Created March 31, 2025 08:12
Add current file path in terminal (Keyboard shortcut for VSCode)

Add the current open file into the terminal.

 {
    "key": "cmd+shift+t",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "${relativeFile}" },
    "when": "terminalFocus"
  }
@Giwan
Giwan / disable-esc-button-exit-fullscreen-on-firefox.md
Created October 9, 2023 20:12
How to disable exit Firefox full screen with escape button
  1. Go to about:config in firefox
  2. Note that you will need to accept the risk warning so abort if you're not comfortable[1]
  3. In the filter input field type "fullscreen"
  4. You should have the option of browser.fullscreen.exit_on_escape
  5. Make sure it's set to false.

[1] This particular change is not very risky however there are other settings that can be changed here that are not so innocent. Make sure that you're careful in this environment and don't just apply anything you read on the internet.

Stop a running docker container with a name tag

docker stop $(docker ps -q -a --filter ancestor=<tag_name> --filter status=running)
@Giwan
Giwan / cpu-temp.md
Created August 4, 2022 07:50
Check CPU temp on Intel mac

CPU Tempurature

This will show the CPU temperature on an intel mac. sudo powermetrics --samplers smc |grep -i "CPU die temperature"

The terminal window will keep reporting the temperature. Note that you'll need sudo priveliges to run this.

Source: https://beebom.com/how-check-cpu-temperature-mac/

@Giwan
Giwan / car-brands.json
Last active July 20, 2022 18:57
list of car brands and models
[
{
"id": 1,
"name": "brand1"
},
{
"id": 2,
"name": "brand2"
}
]
@Giwan
Giwan / copy-indexhtml-with-meta.sh
Last active July 13, 2022 12:42
AWS command in GitHub Workflow to copy the index.html file and add cache-header
#!/bin/bash
if [[ "$1" != "" ]]; then
BUCKETNAME="$1"
else
echo ERROR: A bucket name is required to proceed.
exit 1
fi
# copy from the same bucket and update the meta data.
{
"basics": {
"name": "Giwan Persaud",
"label": "Programmer",
"picture": "",
"email": "[email protected]",
"phone": "0600000000",
"website": "https://mytoori.com",
"summary": "A summary about me",
"location": {
@Giwan
Giwan / git.md
Created April 7, 2020 10:03
Git stuff

copy file from other branch

  1. git checkout targetBranch
  2. git checkout sourceBranch filename.txt

File "filename.txt" is now available in the source branch.

@Giwan
Giwan / list-images.md
Created April 1, 2020 14:17
List all images in src folder by file size

List images and their sizes in a project

du -sh src/**/*.png | sort -sh
@Giwan
Giwan / mongodb.md
Last active August 4, 2018 13:52
Useful queries for mongo db

Search through a list of email addresses

db.getCollection('users').find({"emails.address": "[email protected]"})

This seems straight forward but in the past something something like this "emails.[0].address" was required. That might have been on meteor though.

Fuzzy search using regular expression

db.getCollection('users').find({"emails.address": /keyword/ })