Skip to content

Instantly share code, notes, and snippets.

View 0x77dev's full-sized avatar
:shipit:

Mykhailo Marynenko 0x77dev

:shipit:
View GitHub Profile
@Atinux
Atinux / sse.ts
Last active April 22, 2024 20:39
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)
@sindresorhus
sindresorhus / esm-package.md
Last active May 24, 2024 02:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ifyour
ifyour / aria2.conf
Last active December 3, 2023 16:36
Aria2c Configuration Best Practices
## Disk Settings ##
dir = ${HOME}/Downloads
daemon = false
enable-mmap = true
disk-cache = 64M
file-allocation = none
## Download Settings ##
continue = true
split = 16
@0x77dev
0x77dev / README.md
Last active May 18, 2021 11:01
Install SSH keys from GitHub

Install SSH keys from GitHub

This script installs your public ssh keys from GitHub to your ~/.ssh/authorized_keys.

Example

$ curl -L https://git.io/JTZHT | bash -s 0x77dev

Usage

// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: bus-alt;
// Script to show real time SL departure information using the SL real-time API https://www.trafiklab.se/node/15754/documentation
// Todo: Pass siteID and StopPointNumber as arguments
const siteID = "9001" // 9001 is T-Centralen, replace with your station's ID. See: https://www.trafiklab.se/api/sl-platsuppslag/dokumentation
const myKey = "thekey" // Replace with your key, get it from https://www.trafiklab.se/api/sl-platsuppslag
const timeWindow = "30" // Show departures in the next 30 minutes
@0x77dev
0x77dev / cloudSettings
Last active September 3, 2020 22:01
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-09-03T22:01:49.199Z","extensionVersion":"v3.4.3"}
@qzm
qzm / aria2.conf
Last active April 27, 2024 04:59
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5
@whiskerz007
whiskerz007 / gist:53c6aa5d624154bacbbc54880e1e3b2a
Last active January 3, 2024 00:08
How to setup a community version of Proxmox VE 5.x-6.x
# Disable Commercial Repo
sed -i "s/^deb/\#deb/" /etc/apt/sources.list.d/pve-enterprise.list
apt-get update
# Add PVE Community Repo
echo "deb http://download.proxmox.com/debian/pve $(grep "VERSION=" /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p') pve-no-subscription" > /etc/apt/sources.list.d/pve-no-enterprise.list
apt-get update
# Remove nag
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script
@GnsP
GnsP / docker-clean.sh
Created March 9, 2018 06:57
Clean docker space for mac osx
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi
# remove unused volumes:
docker volume ls -qf dangling=true | xargs docker volume rm
@basarat
basarat / md5.ts
Created November 2, 2017 00:43
Create md5 using TypeScript / JavaScript / NodeJS
import * as crypto from 'crypto';
export const md5 = (contents: string) => crypto.createHash('md5').update(contents).digest("hex");