Skip to content

Instantly share code, notes, and snippets.

View SirwanAfifi's full-sized avatar
🏠
Working from home

Sirwan Afifi SirwanAfifi

🏠
Working from home
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active April 29, 2026 16:47
Minimal APIs at a glance
@kentcdodds
kentcdodds / README.md
Last active March 30, 2024 11:39
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@kentcdodds
kentcdodds / move-photos.js
Created January 11, 2020 00:01
Just a script I wrote to get my downloaded Google Photos into the right place.
const path = require('path')
const fs = require('fs')
const execSync = require('child_process').execSync
if (!process.argv[2] || !process.argv[3]) {
throw new Error('you did not pass the source and destination paths')
}
const searchPath = path.join(process.cwd(), process.argv[2])
const destination = path.join(process.cwd(), process.argv[3])
@AmreeshTyagi
AmreeshTyagi / workbench-ui-fix.sh
Last active February 25, 2026 09:59
Exclude MySQL Workbench from dark theme with mojave Mac dark theme
#!/bin/bash
defaults write com.oracle.workbench.MySQLWorkbench NSRequiresAquaSystemAppearance -bool yes
echo "Successfully patched!"
echo "Now restart MySQL Workbench to see the Workbench in light theme."
#Restart MySQL Workbench after executing this.
@getify
getify / 1.js
Last active July 20, 2022 19:31
regex matching escaped or non-escaped character
var a = "j"; // "j"
var b = "\\j"; // "\j"
var c = "\\\\j"; // "\\j"
var d = "\\\\\\j"; // "\\\j"
var e = "\\\\\\\\j"; // "\\\\j"
var f = "\\\\\\\\\\j"; // "\\\\\j"
var just_j = nonescapedRE("j");
just_j.test(a); // true
just_j.test(b); // false
@bradtraversy
bradtraversy / docker-help.md
Last active May 4, 2026 04:04
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@alirezanet
alirezanet / Iran96-97.json
Last active December 11, 2025 12:52
List of provinces, states and cities of Iran with geographical coordinates (96-97 update)
[
{
"latitude": "34° 31' 24.924",
"longitude": "50° 0' 20.866",
"province": "مرکزی",
"state": "آشتیان",
"city": "آشتیان"
},
{
"latitude": "33° 40' 29.197",
@amrza
amrza / fa.en.numbers.js
Last active June 22, 2018 20:20
Convert numbers to FA/EN [alternative]
/**
* Convert English numbers to Persian.
*
* @param {string} value
* @return {string} converted string.
*/
function faNumbers(value) {
if (typeof value === "number") {
var value = value.toString();
}
@amrza
amrza / fa.en.numbers.js
Last active July 27, 2022 13:33
Convert numbers to FA/EN
/**
* Convert English numbers to Persian.
*
* @param {string} value
* @return {string} converted string.
*/
function faNumbers(value) {
var englishNumbers = {
'0': '۰', '1': '۱', '2': '۲', '3': '۳', '4': '۴',
'5': '۵', '6': '۶', '7': '۷', '8': '۸', '9': '۹'