Skip to content

Instantly share code, notes, and snippets.

View tahir-hassan's full-sized avatar

Tahir Hassan tahir-hassan

View GitHub Profile
@tahir-hassan
tahir-hassan / Android Emulator - Hardware Back, Forward, Overview buttons not working.md
Created January 29, 2025 20:17
Android Emulator - Hardware Back, Forward, Overview buttons not working

Problem

The Back, Home and Overview buttons (left pointing triangle, circle, square) buttons don't do anything when clicked in Emulator.

Solution

Go into avd folder. You will find it in:

  • $ANDROID_AVD_HOME if you have set it.
  • $ANDROID_SDK_HOME\avd
@tahir-hassan
tahir-hassan / Flutter - Emulators not appearing in Visual Studio Code.md
Created January 29, 2025 19:41
Flutter - Emulators not appearing in Visual Studio Code

Problem

When opening a Flutter project in VSCode, in the list of devices you can debug against, you don't see the list of emulators that are listed in Android Studio.

Diagnosis

First run:

avdmanager list avd
@tahir-hassan
tahir-hassan / custom-layouts.json
Created August 16, 2024 15:06
FancyZones 12 by 12 grid (PowerToys v0.81.1)
{
"custom-layouts": [
{
"uuid": "{47386FC1-998E-4355-9E5D-034CB0AD7583}",
"name": "12 by 12",
"type": "grid",
"info": {
"rows": 12,
"columns": 12,
"rows-percentage": [
@tahir-hassan
tahir-hassan / readme.md
Created June 9, 2024 20:20
Settings for Cursor column highlight VSCode extension

Settings for Cursor column highlight VSCode extension

These are my settings for the Cursor column highlight extension for VSCode.

{
    "cursor-column.showBorder": true,
    "workbench.colorCustomizations": {
        "cursorColumnColor": "#1f231f"
 }
@tahir-hassan
tahir-hassan / README.md
Created February 22, 2024 22:23
Installing Markdown Preview on LunarVim on Windows

To install Markdown Preview in LunarVim on Windows, follow these steps:

In config.lua add the following to your lvim.plugins table:

{
    "iamcco/markdown-preview.nvim",
    cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
    ft = { "markdown" }
}
@tahir-hassan
tahir-hassan / info.md
Created January 6, 2023 13:04
WezTerm - Configuration to send Control-w in response to Control-Backspace

On Windows, you should be able to create a .wezterm.lua in $HOME (which is really just $HOMEDRIVE + $HOMEPATH).

Here is a sample .wezterm.lua which sends a Control-w in response to Control-Backspace, useful for deleting a word behind the cursor:

local wezterm = require 'wezterm'
local act = wezterm.action

return {
@tahir-hassan
tahir-hassan / init.lua
Created November 21, 2022 23:35
For NeoVim, converting an init.vim to an init.lua
vim.o.breakindent = true
vim.o.linebreak = true
vim.o.number = true
vim.o.relativenumber = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
@tahir-hassan
tahir-hassan / Set-PSConsoleReadLineSelectionState.ps1
Created February 27, 2022 23:39
`PSConsoleReadLine` has a `GetSelectionState` method but no `SetSelectionState` method. `Set-PSConsoleReadLineSelectionState` will enable you to set the selection state and also specify if the selection was done backwards or forwards (by default it is forwards).
Function Set-PSConsoleReadLineSelectionState
{
param(
[Parameter(Mandatory)][int]$Start,
[Parameter(Mandatory)][int]$Length,
[ValidateSet('Backward', 'Forward')][string]$Direction='Forward'
)
$startCursorPosition,$selectChar = switch ($Direction)
{
@tahir-hassan
tahir-hassan / AltF4ToExit.ps1
Last active September 8, 2021 00:18
A script that enables you to use Alt+F4 to exit the PowerShell instance.
Set-PSReadLineKeyHandler -Key 'Alt+F4' `
-BriefDescription ExitPowerShell `
-LongDescription "Exits PowerShell" `
-ScriptBlock {
param($key, $arg)
$line = $null;
$cursor = $null;
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref] $line, [ref] $cursor);
[Microsoft.PowerShell.PSConsoleReadLine]::Delete(0, $line.Length);
@tahir-hassan
tahir-hassan / GetCircleFromPoints.ps1
Created July 18, 2021 17:01
PowerShell code to get a circle from three points on an arc.
class Point {
[double]$X;
[double]$Y;
Point([double]$x, [double]$y) {
$this.X = $x;
$this.Y = $y;
}
[Point]Add([double]$xDelta, [double]$yDelta) {