Skip to content

Instantly share code, notes, and snippets.

View onattech's full-sized avatar
🌍
Working

Onat onattech

🌍
Working
View GitHub Profile
@onattech
onattech / FaviconFix.html
Last active February 4, 2023 11:44
Add this to index.html to get rid of the missing favicon error
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
@onattech
onattech / jsdoc example.js
Created February 1, 2023 14:37
Jsdoc example with many possible types
/**
* Adds two numbers together.
*
* @function
* @param {number} x - The first number to add.
* @param {number} y - The second number to add.
* @returns {number} The sum of `x` and `y`.
* @throws {TypeError} Will throw an error if `x` or `y` is not a number.
* @example
* add(1, 2); // Returns: 3
@onattech
onattech / docker-compose.yml
Created January 29, 2023 09:20
Docker postgresql linux permission issue resolved
version: "3"
services:
postgres:
image: "postgres:14.5"
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: users
logging:
@onattech
onattech / loop.go
Last active January 26, 2023 08:49
Go app to run a command in a loop for x amount of time
package main
import (
"fmt"
"log"
"os/exec"
"time"
)
func main() {
@onattech
onattech / console.log.css
Last active January 25, 2023 12:35
Console log substitue for CSS
* {
box-sizing: border-box;
outline: 1px solid limegreen !important;
}
or
* {
box-sizing: border-box;
background: rgb(0 100 0 / 0.1) !important;
@onattech
onattech / getTime.bash
Last active January 17, 2023 12:08
Bash function to return formatted time and duration until now
# put it in .bashrc file
# call it as `t 1674208994`
alias t=showTime
function showTime () {
date -d @$1 +"%a %b %d %T %z %Y"
if [[ $1 < $(date +%s) ]]; then
ago="ago"
@onattech
onattech / Ternary in JS object
Last active December 8, 2022 14:37
Ternary in JS object
const customTheme = (mode) => ({
palette: {
mode,
primary: {
main: "#0073C6",
light: "rgba(0, 115, 198, 0.16)",
},
...(mode === "light"
? {
success: {
@onattech
onattech / Javascript sleep
Last active September 18, 2022 10:50
Javascript sleep
function sleep(seconds) {
let now = performance.now()
// Artificial delay -- do nothing for 2 seconds
while (performance.now() - now < seconds * 1000) {}
return `Slept for ${seconds} second(s)`
}
sleep(2) //? Slept for 2 seconds
@onattech
onattech / FirefoxNetoworkFilter
Last active April 4, 2022 09:30
Firefox network filter
-refreshtoken -status-code:204