Skip to content

Instantly share code, notes, and snippets.

View tyriis's full-sized avatar
🏡
Working from home

Nils Müller tyriis

🏡
Working from home
View GitHub Profile

⚠️ This gist is no longer updated! For maintained, improved and even more extended guide click here.


How to use Discord Webhook

It's a JSON

First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.

@tyriis
tyriis / esm-package.md
Created May 1, 2023 20:35 — forked from sindresorhus/esm-package.md
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.
@tyriis
tyriis / esm-package.md
Created May 1, 2023 20:35 — forked from sindresorhus/esm-package.md
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.
@tyriis
tyriis / package.json
Last active December 13, 2022 21:39
split a yaml file into multiple ones based on the first level key
{
"name": "split-yaml",
"version": "1.0.0",
"main": "split-yaml.js",
"scripts": {
"split": "node split-yaml.js"
},
"dependencies": {
"js-yaml": "^3.14.0",
"readline": "^1.3.0"
@tyriis
tyriis / config.yaml
Last active April 22, 2021 11:50
hue scene to ha
productivity:
brightness: 100
light_color: 233
energy:
brightness: 100
light_color: 156
chill:
brightness: 57
light_color: 447
read:
@tyriis
tyriis / proto.java
Last active November 12, 2018 22:22
package dslab.DMTP;
import dslab.entities.Message;
import dslab.entities.User;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Socket;
import java.util.ArrayList;
@tyriis
tyriis / read_cookies.js
Last active November 8, 2018 13:17
read cookies
var cookies = document.cookie.split(';').reduce(function(cookies, cookie) {
cookies[cookie.split("=")[0].trim()] = unescape(cookie.split("=")[1]);
return cookies
}, {})
console.log(cookies.sec_session_id)
@tyriis
tyriis / psql_db_user.sql
Last active November 2, 2018 20:47
Creating user, database and adding access on PostgreSQL
-- source: https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e
CREATE DATABASE yourdbname;
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
@tyriis
tyriis / pacaur_install.sh
Created July 31, 2018 20:40 — forked from tadly/pacaur_install.sh
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
@tyriis
tyriis / myCA.md
Last active June 4, 2018 09:05
Create local CA for trusted self signed https certificates

create myCA private key

openssl genrsa -des3 -out myCA.key 2048

create myCA certificate

openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem