Skip to content

Instantly share code, notes, and snippets.

View abdullahkhalids's full-sized avatar

Abdullah Khalid abdullahkhalids

View GitHub Profile
@abdullahkhalids
abdullahkhalids / charharf_colorizer.js
Last active March 24, 2024 00:09
Improved UI for Charharf Urdu game
javascript:(function(){const%20t=document.querySelector("%23scores%20tbody"),l=[["%23fac527","%23fac527","%23fac527","%23fac527"]],c=["%23fac527","%23f27d2f","%233799f9","%23686868"];t.addEventListener("click",e=>{if(e.target.classList.contains("letter")){const%20r=e.target.closest("tr").rowIndex,o=Array.from(e.target.parentNode.children).indexOf(e.target);l[r][o]=c[l[r][o]===c[c.length-1]?0:c.indexOf(l[r][o])+1],e.target.style.backgroundColor=l[r][o]}});const%20m=new%20MutationObserver((e=>{e.forEach(e=>{if(e.addedNodes.length)recolorRows()})}));m.observe(t,{childList:!0});function%20recolorRows(){const%20e=t.querySelectorAll("tr");l.unshift(new%20Array(4).fill("%23fac527"));e.forEach((e,r)=>{const%20o=e.querySelectorAll(".letter");o.forEach((e,o)=>{e.style.backgroundColor=l[r][o]})})};recolorRows();})();
@abdullahkhalids
abdullahkhalids / mdnb.el
Last active April 19, 2024 00:40
Markdown-notebook minor mode for emacs
;; markdown-notebook mode
;; Helps you to insert python code blocks and execute their results
;; and place output back inside the document.
;; Install
;; Put this file somewhere and then add the following line to your emacs.el
;; (load-file "~/path/to/mdnb.el")
;; Help
;; Load the minor mode with M-x markdown-notebook-mode
#!python
import shutil
import os
import sys
import subprocess
from datetime import date
import re
@abdullahkhalids
abdullahkhalids / steamsysteminformation
Created September 2, 2022 03:33
Steam Sytem Information
Computer Information:
Manufacturer: LENOVO
Model: 20HDCTO1WW
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
CPU Family: 0x6
@abdullahkhalids
abdullahkhalids / pipewire-bluetooth-headphone-manager
Created March 9, 2022 16:09
A bash script that helps reliably connect to bluetooth headphones. Just bind the three possible inputs to different keyboard shortcuts.
#!/bin/bash
#sudo systemctl start bluetooth.service
connect() {
bluetoothstatus=`bluetooth | cut -c 13-`
if [ "$bluetoothstatus" == "off" ]; then
bluetooth on
@abdullahkhalids
abdullahkhalids / scratch.el
Created August 8, 2013 22:11
This emacs function helps quickly record ideas. Run it and open a buffer ready to jot down an idea
;; Scratch
;; This program helps keep a record of ideas.
;; Last edit: 2012-07-05
;; Every time (scratch) is called a new buffer is opened. Title
;; is today's date appended before a user inputed title.
;Needed features
;* An interactive shell that shows me a list of entries
; from a certain time period.
@abdullahkhalids
abdullahkhalids / pensieve.el
Created August 8, 2013 22:09
This emacs function helps keep a journal.
;; Pensieve
;; This program helps keep a journal.
;; Last edit: 2012-06-29.
; A journal is simply a list of textfiles, at most one for every
; day.
; Put into your emacs load directory
; Run with M-x pensieve to open a file, ready to write
;Needed features
;* An interactive shell that shows me a list of entries
@abdullahkhalids
abdullahkhalids / send2kindle
Created August 8, 2013 21:46
This bash script takes links from an rss feed and sends .mobi files to an address (usually your kindle email) for easy reading. It has some Kippt specific tuneups, so might not easily work with other feeds.
#!/bin/bash
#this bash script takes links from an rss feed and sends
#.mobi files to an address (usually your kindle email)
#for easy reading.
#Usage is to set the rss url below and run the script
#Dependencies
# https://launchpad.net/ubuntu/precise/+package/html-xml-utils