Skip to content

Instantly share code, notes, and snippets.

Hide Firefox Tabs

This will hide the tabs while keeping the window control buttons accessible for Firefox on macOS.

  1. Open your Firefox profile directory:

    • Go to about:profiles in the Firefox address bar.
    • Find your profile and click on "Open Folder".
  2. Create a chrome folder in the profile directory if it doesn't exist.

@himalay
himalay / global.mjs
Created November 18, 2022 14:56
Nodejs Global Variables in ES Module
import path from 'path';
import {fileURLToPath} from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
console.log('file-name 👉️', __filename);
console.log('directory-name 👉️', __dirname);
@himalay
himalay / createCssClassName.ts
Created October 19, 2022 08:23
Create a valid CSS class name from a string
function createCssClassName(str: string) {
return str
.toLowerCase()
.replace(/^(-?[0-9]|--)|[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "")
.trim()
.replace(/\s+/g, "-");
}
@himalay
himalay / ab.md
Created September 13, 2022 06:46
Stress testing using Apache HTTP server benchmarking tool

Stress testing using Apache HTTP server benchmarking tool

  • Documentation
  • Installation
    • Ubuntu:
      • sudo apt update && sudo apt install apache2-utils
    • Windows:
@himalay
himalay / broadcaster.js
Created September 7, 2021 06:29
Simple UDP broadcaster and listener in Node.js
import { createSocket } from 'dgram'
const PORT = process.env.UDP_LISTENER_PORT || 41234
const socket = createSocket('udp4')
const message = Buffer.from('MST_TV_SERVER')
socket.bind(() => {
socket.setBroadcast(true)
@himalay
himalay / heimdall.sh
Last active May 17, 2021 04:00
Heimdall
# flash recovery
heimdall flash --RECOVERY twrp-3.5.2_9-0-star2lte.img
# flash modem
heimdall flash --RADIO modem.bin --CP_DEBUG modem_debug.bin
@himalay
himalay / auto-dns.sh
Last active July 9, 2023 13:14
[Pi-hole auto DNS switch] The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status. #pihole #openwrt
#!/bin/sh
# The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status.
TARGET=192.168.0.7 # Pi-hole
FALLBACK_A=1.1.1.1 # Cloudflare
FALLBACK_B=1.0.0.1 # Cloudflare
function set_fallback_dns() {
echo $(date)
@himalay
himalay / dark.md
Created September 23, 2020 15:23
Dark theme
limit_req_zone $binary_remote_addr zone=myWebsiteFrontLimit:10m rate=10r/s;
server {
root /var/www/my-angular-app/dist/my-angular-app;
index index.html;
server_name www.my-website.ro my-website.ro;
location / {
@himalay
himalay / timeago.js
Created April 14, 2020 04:43
timeago #js
// https://github.com/odyniec/tinyAgo-js/
function ago(val) {
val = 0 | (Date.now() - val) / 1000;
var unit, length = { second: 60, minute: 60, hour: 24, day: 7, week: 4.35,
month: 12, year: 10000 }, result;
for (unit in length) {
result = val % length[unit];
if (!(val = 0 | val / length[unit]))