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
bonniss / AppAgencyRole.java
Last active August 4, 2024 18:38
Entity sample sinh bởi JHipster
package vn.ric.dragon.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import java.time.Instant;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.domain.Persistable;
@bonniss
bonniss / swap-space-ubuntu-guide.md
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](https://askubuntu.com/questions/652337/why-are-swap-partitions-discouraged-on-ssd-drives-a

@bonniss
bonniss / esm-package.md
Created June 9, 2024 13:38 — 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.
@bonniss
bonniss / ts-setup.md
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
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">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css"
/>
<title>Beautiful Sample Page</title>
@bonniss
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
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
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
@bonniss
bonniss / gl-param-datasource.json
Last active February 27, 2022 20:12
JSONPlaceholder.me
[
{
"labelKey": "label",
"valueKey": "value",
"data": [
{
"label": "Handmade",
"value": "car"
},
{
@bonniss
bonniss / project-create.sh
Created February 11, 2022 03:23 — forked from francoisromain/project-create.sh
A bash script to create a Git post-receive hook to deploy after a Git push
#!/bin/bash
# source: https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3
# and another script to delete the directories created by this script
# project-delete.sh: https://gist.github.com/francoisromain/e28069c18ebe8f3244f8e4bf2af6b2cb
# Call this file with `bash ./project-create.sh 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("t.dragonbound.net");
var VERSION = 101,
SERVER_ADDRESS = -1 != location.hostname.indexOf("t.dragonbound.net") ? "http://t.dragonbound.net:9000" : "http://game.dragonbound.net:80",
LOCATION_TYPE_UNKNOWN = "unknown",
LOCATION_TYPE_CHANNEL = "channel",
LOCATION_TYPE_ROOM = "room",
ROOM_STATUS_WAITING = "W",
ROOM_STATUS_FULL = "F",