Skip to content

Instantly share code, notes, and snippets.

@zcaudate
zcaudate / letsencrypt-guide-nginx-acme.sh.md
Created November 20, 2022 13:06 — forked from dorelljames/letsencrypt-guide-nginx-acme.sh.md
SSL via Let's Encrypt (nginx server)

Nginx SSL via Let's Encrypt and acme.sh

This guide is intended to walk you through installation of a valid SSL on your server for your site at example.com. This example is using root user, you may need to use sudo if you encounter problems such as write permissions.

Pre-requisites

  • Install acme.sh on your server. This will create a acme.sh folder in your home directory and more importantly create an everyday cron job to check and renew certificates if needed.
  • Install nginx server (different per distibution so just make sure you have it up and running)
@zcaudate
zcaudate / itertools.js
Created November 19, 2021 10:02 — forked from archanpatkar/itertools.js
Using ES6 Generator prototype model to implement lazy chaining. When you set the prototype of multiple Generator Functions to a common prototype you can chain them. Examples at the bottom. (this code currently only works in Firefox Aurora, but will eventually work in all JS engines).
const module = { exports: {} };
let exports = module.exports;
const GeneratorFunction = function*(){}.constructor;
const iteratorSymbol = (typeof Symbol === "function" && Symbol.iterator) || "@@iterator";
const MISSING = {};
/**
* A generator function is always called as a constructor. If multiple
* generators share the same prototype, and you put generators on that shared
@zcaudate
zcaudate / redis.markdown
Created April 23, 2021 06:53 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@zcaudate
zcaudate / homebrew-mirror-in-china.sh
Created February 18, 2021 12:31 — forked from shrekuu/homebrew-mirror-in-china.sh
homebrew 中国镜像服务, 清华大学与中科大
# 清华大学:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 手动修改 bottles 地址:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# 或:
@zcaudate
zcaudate / create-mint-sh
Last active January 31, 2021 05:51 — forked from gildas/create-mint-sh
Create Linux Mint USB on Mac OS/X
#! /usr/bin/env bash
# Insert a USB key.
# if needed initialize it with MS/DOS FAT and MBR
# Download the Mint ISO image
# Convert the ISO -> IMG
hdiutil convert -format UDRW -o linuxmint-20.1-cinnamon-64bit linuxmint-20.1-cinnamon-64bit.iso
# Check where the USB drive has been mounted
import java.io.IOException;
import java.io.NotSerializableException;
import java.util.Iterator;
import clojure.lang.ASeq;
import clojure.lang.ISeq;
import clojure.lang.IPersistentMap;
public class IteratorSeq extends ASeq{
final Iterator iter;
final State state;
@zcaudate
zcaudate / HotSpot JVM intrinsics
Created August 15, 2020 14:33 — forked from apangin/HotSpot JVM intrinsics
HotSpot JVM intrinsics
_hashCode java/lang/Object.hashCode()I
_getClass java/lang/Object.getClass()Ljava/lang/Class;
_clone java/lang/Object.clone()Ljava/lang/Object;
_dabs java/lang/Math.abs(D)D
_dsin java/lang/Math.sin(D)D
_dcos java/lang/Math.cos(D)D
_dtan java/lang/Math.tan(D)D
_datan2 java/lang/Math.atan2(DD)D
_dsqrt java/lang/Math.sqrt(D)D
_dlog java/lang/Math.log(D)D
@zcaudate
zcaudate / libc.clj
Last active June 23, 2020 17:22
jnr-ffi example
(ns libc
(:require [jise.core :refer [defclass]])
(:import (jnr.ffi LibraryLoader
Pointer
Struct
Struct$SignedLong
Struct$time_t)
(jnr.ffi.annotations Out Transient)))
;;
FROM https://stackoverflow.com/questions/45372848/docker-swarm-how-to-find-out-why-service-cant-start
journalctl -u docker.service | tail -n 50
It depends on your OS. Here are the few locations, with commands for few Operating Systems:
Ubuntu (old using upstart ) - /var/log/upstart/docker.log
Ubuntu (new using systemd ) - journalctl -u docker.service
Boot2Docker - /var/log/docker.log
Debian GNU/Linux - /var/log/daemon.log
CentOS - /var/log/daemon.log | grep docker
(ns hara.state.ova
(:require [clojure.set :as set]
[hara.core.base.error :as error]
[hara.core.base.shorthand :as hand]
[hara.core.base.util :as util]
[hara.state.base.common :as common]
[hara.state :as state]
[hara.watch :as watch]))
(defn- ova-state