Skip to content

Instantly share code, notes, and snippets.

View adil1214's full-sized avatar
:electron:

ADIL adil1214

:electron:
  • Home GmbH
  • Casablanca, Morocco.
View GitHub Profile
@adil1214
adil1214 / #deepFreeze.ts
Created October 8, 2023 18:01 — forked from tkrotoff/#deepFreeze.ts
Deeply freezes an object
import { ReadonlyDeep } from 'type-fest';
/**
* Deeply freezes an object by recursively freezing all of its properties.
*
* https://gist.github.com/tkrotoff/e997cd6ff8d6cf6e51e6bb6146407fc3
* https://stackoverflow.com/a/69656011
*
* FIXME Should be part of Lodash: https://github.com/Maggi64/moderndash/issues/139
*
@adil1214
adil1214 / a.js
Created February 6, 2022 20:17
aaaaa
let box1 = document.getElementById('box1');
let box2 = document.getElementById('box2');
let ypos1 = 0;
let ypos2 = 0;
let counter1 = 0;
let counter2 = 0;
let text0 = document.querySelector('#text0');
let input = document.querySelector('#input');
let reverse = false;
@adil1214
adil1214 / PowerShell Customization.md
Created April 12, 2021 01:18 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

// github tends to ruin vscode indentation after pushing code to it
// this is a get parameter to specify tab length when viewing code in github
?ts=2
eg:
https://github.com/adil1214/repo-name/blob/main/App.js?ts=2
@adil1214
adil1214 / crontab.sh
Created June 9, 2019 13:23
crontab commands to shutdown wireless & client mode in wisp mode (openwrt)
#crontab
# disable/enable wireles interface (@wifi-iface)/(client)
# this is to disable (at 21:10 everyday)
10 21 * * * uci set wireless.@wifi-iface[3].disabled='1' ; wifi
# and this to enable (...)
13 21 * * * uci delete wireless.@wifi-iface[3].disabled ; wifi
# =================================
# disable/enable ap (...)
10 21 * * * uci set wireless.@wifi-iface[1].disabled='1'; wifi
sendcmd 1 DB p WLANCfg ///for the wireless info
sendcmd 1 DB p WLANPSK ///for the wireless passwords
sendcmd 1 DB p DevAuthInfo ///for the interface credantials :D
@adil1214
adil1214 / a.sh
Last active July 27, 2020 16:15
useful commands
# display x last commits one for each line
git log --oneline -n x
# quickly peek the available scripts
cat package.json | grep "scripts" -A 10
# clone a specific branch from a repo
git clone --single-branch --branch <branchname> <remote-repo>
# fetching all the branches and checking into one branch
@adil1214
adil1214 / .prettierrc
Created February 21, 2019 17:54
My prettier config
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": true,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens":"avoid"
@adil1214
adil1214 / database.rules.json
Created February 20, 2019 02:03 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@adil1214
adil1214 / mongo_dump_restore.md
Created January 6, 2019 17:19 — forked from saggiyogesh/mongo_dump_restore.md
Mongodb dump and restore from mlab
  • install mongodb on local machine (mongodump & mongorestore) commands are required.
  • command dumping

mongodump -h xxx11.mlab.com:11 -u user -p password --authenticationDatabase release-db -d release-db -o /home/dumps

**Options** `-h`: mlab host:port, `-u`: db user, `-p`: db user password, `--authenticationDatabase` `-d`: mlab dbname, `-o`: path to store backupfiles
  • restore command, to restore locally

    mongorestore --db dname /home/dumps

Otherwise to restore in mlab, create a new db and replace the options