Skip to content

Instantly share code, notes, and snippets.

View bonniss's full-sized avatar
Cancer - Croissant

Dan Teddy bonniss

Cancer - Croissant
View GitHub Profile
bonniss /
Last active June 16, 2024 15:07
Guide to add Swap Space on Ubuntu

Guide to add Swap Space on Ubuntu

Tested on Ubuntu Server 18.04, 20.04

  • Swap is a portion of hard drive storage that has been set aside for the OS to temporarily store data that it can no longer hold in RAM.
    • The swap space on the hard drive will be used mainly when there is no longer sufficient space in RAM to hold in-use application data.
  • Though the information written to disk will be significantly slower than information kept in RAM, the OS will prefer to keep running application data in memory and use swap for the older data.

It is believed that placing swap partitions on an SSD drive is not advisable, as it may harm the device. Actually, the write-cycle on modern SSDs is good enough that you'll likely replace the drive before it becomes a problem. Read this Reddit post, these AskUbuntu [one](

bonniss /
Created June 9, 2024 13:38 — forked from sindresorhus/
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.
bonniss /
Last active June 4, 2024 07:24
A lean Typescript setup for Node.js development

Typescript setup for Node.js development

1. Initialize the Project

First, create a new directory for your project and initialize it with npm.

mkdir my-tool
cd my-tool
npm init -y
bonniss / sample-watercss.html
Created January 9, 2024 12:09
Beautiful sample HTML page - grab and replace your NGINX default site!
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beautiful Sample Page</title>
bonniss / memory_cache.js
Created February 5, 2023 16:23 — forked from mitio/memory_cache.js
Simple in-memory JavaScript object cache with a maxAge per key (in seconds) and maxEntries limit (per cache instance).
var MemoryCache = function (options) {
options = $.extend(true, {
maxEntries: null
}, options || {});
var self = this;
var cache = {};
var entries = 0;
var ageOf = function (entry) {
bonniss / ansible-macos-homebrew-packages.yml
Created June 26, 2022 01:49 — forked from mrlesmithjr/ansible-macos-homebrew-packages.yml
Install MacOS Homebrew Packages With Ansible
- name: Install MacOS Packages
hosts: localhost
become: false
- atom
- docker
- dropbox
- firefox
bonniss / gl-param-datasource.json
Last active February 27, 2022 20:12
"labelKey": "label",
"valueKey": "value",
"data": [
"label": "Handmade",
"value": "car"
bonniss /
Created February 11, 2022 03:23 — forked from francoisromain/
A bash script to create a Git post-receive hook to deploy after a Git push
# source:
# and another script to delete the directories created by this script
# Call this file with `bash ./ project-name`
# - project-name is mandatory
# This will creates 4 directories and a git `post-receive` hook.
if ("undefined" == typeof ZotataPlayUserID) var ZotataPlayUserID = "";
if ("undefined" == typeof ZotataPlayAuthKey) var ZotataPlayAuthKey = "";
if ("undefined" == typeof debug) var debug = -1 != location.hostname.indexOf("");
var VERSION = 101,
SERVER_ADDRESS = -1 != location.hostname.indexOf("") ? "" : "",
bonniss / dataset-1.json
Last active October 20, 2021 03:06
Dummy GA User Flows
{"filter":{"countries":{"id":"viet-nam","name":"Việt Nam"}},"meta":{"createAt":"2021-10-20T03:04:40.373Z"},"cols":[{"level":0,"nodes":[{"pageId":"page-khach-hang-than-thiet","id":"0-page-khach-hang-than-thiet"},{"pageId":"page-ho-tro-tien-ban","id":"0-page-ho-tro-tien-ban"},{"pageId":"page-chung-khoan-upcom","id":"0-page-chung-khoan-upcom"},{"pageId":"page-sao-ke-truc-tuyen","id":"0-page-sao-ke-truc-tuyen"},{"pageId":"page-others","id":"0-page-others"}]},{"level":1,"nodes":[{"pageId":"page-khach-hang-than-thiet","id":"1-page-khach-hang-than-thiet"},{"pageId":"page-trang-chu","id":"1-page-trang-chu"},{"pageId":"page-dat-lenh","id":"1-page-dat-lenh"},{"pageId":"page-chung-khoan-phai-sinh","id":"1-page-chung-khoan-phai-sinh"},{"pageId":"page-others","id":"1-page-others"}]},{"level":2,"nodes":[{"pageId":"page-mo-tai-khoan","id":"2-page-mo-tai-khoan"},{"pageId":"page-sao-ke-truc-tuyen","id":"2-page-sao-ke-truc-tuyen"},{"pageId":"page-dang-ky-quyen-mua","id":"2-page-dang-ky-quyen-mua"},{"pageId":"page-tai-lieu-huon