Skip to content

Instantly share code, notes, and snippets.

Avatar
🔴
Streaming coding sessions on Twitch!

Jaid

🔴
Streaming coding sessions on Twitch!
View GitHub Profile
View esm-package.md

Pure ESM package

The package linked to from 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.
@ourownstory
ourownstory / encrypted_dual_boot_xps_17.md
Last active Aug 2, 2022
Encrypted dual boot setup for Pop!_OS and Windows 10 using LUKS and Bitlocker on Dell XPS 17 9700
View encrypted_dual_boot_xps_17.md

Encrypted dual boot setup with Pop!_OS and Windows 10

How to guide, using LUKS and Bitlocker on Dell XPS 17 9700

This guide is for those who want to use their XPS 17 in dual boot with their (preinstalled) Windows 10 and a new Pop!_OS installation, without giving up Bitlocker Encryption in Windows nor LUKS encryption in Linux.

The only guides that I could find were for Ubuntu, which it should be identical to, but I found the ommission of a few steps to resolve issues that I encountered in my first install attempt. Hoping to save you some trouble, I am sharing the steps that worked for me, linking the original guides that I found useful.

1. Preparation

  • 1.1 Of course: Backup all your data! You always do this when people tell you to, right? Maybe this time better be safe than sorry.
  • 1.2 Safely note your Bitlocker recovery key somewhere off your XPS. Where to find it
@ryanburnette
ryanburnette / Caddyfile
Last active May 4, 2021
caddy cache strategy
View Caddyfile
(asset-paths) {
path *.bmp *.jpg *.png *.svg *.gif *.pdf *.css *.js
}
(cache) {
@content {
not {
import asset-paths
}
}
header @content cache-control max-age=0
@fworks
fworks / install-zsh-windows-git-bash.md
Last active Aug 8, 2022
Zsh / Oh-my-zsh on Windows Git Bash
View install-zsh-windows-git-bash.md
View Turn_Off_Windows_10_Defender_Antivirus.reg
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: May 6th 2015
; Updated on: April 16th 2017
; Tutorial: https://www.tenforums.com/tutorials/5918-turn-off-windows-defender-windows-10-a.html
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
@Aerijo
Aerijo / tree_sitter_guide.md
Last active Jul 19, 2022
Guide to writing your first Tree-sitter grammar
View tree_sitter_guide.md

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

@styblope
styblope / docker-api-port.md
Last active Aug 4, 2022
Enable TCP port 2375 for external connection to Docker
View docker-api-port.md

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
View xvfb_screen_recording.py
from selenium import webdriver
import sys, getopt, time, subprocess, shlex
from xvfbwrapper import Xvfb
def run():
print('Sreencast website animation')
xvfb = Xvfb(width=1280, height=720, colordepth=24)
xvfb.start()
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active Aug 6, 2022
using Include in sequelize
View Include-in-Sequelize.md

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@BojanStipic
BojanStipic / fonts.conf
Last active Apr 27, 2019
Linux color emoji
View fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>NotoSans</family>
<family>NotoColorEmoji</family>
<family>NotoEmoji</family>
</prefer>