Skip to content

Instantly share code, notes, and snippets.


Kahtaf Alam Kahtaf

View GitHub Profile
View gist:814c53231309ac1ea403d82969360b41
# Stop Home Assistant services
sudo systemctl stop hassio-supervisor.service && \
sudo systemctl stop hassio-apparmor.service && \
sudo systemctl disable hassio-supervisor.service && \
sudo systemctl disable hassio-apparmor.service && \
sudo rm -rf /etc/systemd/system/hassio-supervisor.service && \
sudo rm -rf /etc/systemd/system/hassio-apparmor.service
# Remove Home Assistant directories
sudo rm -rf /usr/sbin/hassio-supervisor && \
Kahtaf / bitwarden-env.yml
Created Jun 5, 2022
Github Actions - Download secret note from BitWarden - Great for storing .env files
View bitwarden-env.yml
- name: Download .env from BitWarden
# Client ID and Secret can be found in
# BitWarden master password required for unlocking vault
Kahtaf / index.js
Created Sep 15, 2020
Create a simple CORS proxy with Cloudflare Workers to bypass CORS restrictions in the browser. Perfect for local development.
View index.js
* Create a simple CORS proxy with Cloudflare Workers
* to bypass cors restrictions in the browser.
* Example Usage: https://<worker_subdomain>
addEventListener('fetch', event =>
Kahtaf /
Created Aug 3, 2017
Android Preferences - Reusable widget layout for a preference and it's onClick listener
// Parent activity of the preference screen
// onClick listener for reusable preference widget.
public void onPreferenceSecondaryButtonClicked(View view){
// Gets a reference to the preference that contains this widget
ListView preferenceList = (ListView) view.getParent().getParent().getParent();
int preferencePosition = preferenceList.getPositionForView(view);
Preference preference = (Preference) preferenceList.getAdapter().getItem(preferencePosition);
// Add onclick logic here, using reference to the preference object that contains this widget
Kahtaf / KeyboardEntry.cs
Last active Jan 26, 2017
Xamarin.Forms custom renderer for an Entry that forcibly shows/hides the keyboard on demand. Useful when Entry.Focus() and Entry.Unfocus() does not work as intended.
View KeyboardEntry.cs
using Xamarin.Forms;
namespace Project.Controls
public class KeyboardEntry : Entry
#region ShowKeyboardProperty
public static readonly BindableProperty ShowKeyboardProperty = BindableProperty.Create<KeyboardEntry, bool>(p => p.ShowKeyboard, default(bool));