Skip to content

Instantly share code, notes, and snippets.

View crotel's full-sized avatar
😉
have a good day~

CROTEL crotel

😉
have a good day~
View GitHub Profile
@crotel
crotel / ddns.service
Last active March 22, 2020 05:58
Cloudflare Dynamic Dns with custome api token. with little changed. let log file would not too big.
[Unit]
Description=Cloudflare Dynamic DNS service
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
StandardOutput=journal
StandardError=journal
@crotel
crotel / keymap.cson
Last active March 21, 2020 11:21
Auto Indent function for atom with two line Keymap addon. After add this, do auto indent for keyboard shortcut ' command + i '.
'atom-text-editor':
'cmd-i': 'editor:auto-indent'
@crotel
crotel / .bashrc
Last active October 16, 2020 09:56
Create test js with 'date + time' stamp name-rule in shell
$ echo "alias njs='stamp=$(date +"%F_%H%M%S") && vim "$stamp".js';" >> ~/.bashrc
$ echo "alias llnjs="ls -1 | egrep -e '[[:digit:]]{1,4}\-[[:digit:]]{1,2}\-[[:digit:]]{1,2}\_'";" >> ~/.bashrc
$ source ~/.bashrc
/*
## Create
$ njs
## Listing
@crotel
crotel / mime.js
Last active October 16, 2020 09:54
class mime sample. add type in need
const mime = {
getType: function (el) {
let t = el.split('.')[1];
this.type = {
json: 'application/json',
ico: 'image/x-icon',
png: 'image/png',
woff: 'font/woff',
woff2: 'font/woff2',
js: 'text/javascript',
@crotel
crotel / getHash.js
Last active July 26, 2021 03:51
Generate Hash-ID in six way: random, hex, md5, sha1, uuid, udid. addon: a timestamp join-with random num.
/* getHash v10 */
/*
* Notice: UDID original base at localhost mac-addr, otherwise using tunnl and uuidEncode with remote mac-addr.
*
* Unique ID (random): hex.encode, sha1.encode, md5.encode, uuid([leave blank]),
* Decodable string: hex.encode,
* One-way transformation (one Time): sha1.encode, md5.encode, uuid([give value]), udid.
*
* ascii for encode and decode zh-chs char with ascii code.
* browser code fix get date block.
@crotel
crotel / sslverify.sh
Last active July 7, 2021 15:02
A ssl cert and key verify shell
#!/bin/bash
# createAt 20210701
# Author: CROTEL
#
# Usage:
#
# ./sslverify.sh cert=/etc/nginx/ssl/server.crt key=/etc/nginx/ssl/server.key
#
# crt and key must use absolutely location
#
@crotel
crotel / signaling_mqtt.html
Created March 3, 2022 17:21 — forked from mganeko/signaling_mqtt.html
WebRTC signaling over MQTT
<!DOCTYPE html>
<html>
<head>
<title>MQTT signaling</title>
<meta charset="urt-8"/>
<script src="http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/plain/src/mqttws31.js"></script>
</head>
<body>
<button type="button" onclick="startVideo();">Start video</button>
<button type="button" onclick="stopVideo();">Stop video</button>
Line Properties broker1 Values (mosquitto.br_conf) broker0 Values (mosquitto.conf) Description
210 port 1884 1883 Port to use for the default listener
310 tls_version tlsv1.2 tlsv1.2 the version of the TLS protocol to use for this listener
374 listener - 8883 listener port-number [ip address/host name]
450 cafile - C:\...\mosquitto\certs\ca.crt defines the path to a file containing the CA certificates
454 certfile - C:\...\mosquitto\certs\server.crt Path to the PEM encoded server certificate
457 keyfile - C:\...\mosquitto\certs\server.key Path to the PEM encoded keyfile
651 allow_anonymous false false If `password_file` or `psk_file` is set
669 password_file C:\...\mosquitto\passwordfile.pwd C:\...\mosquitto\passwordfile.pwd If password_file is set the auth_plugin check will be made first
728 acl_file C:\...\mosquitto\acl.acl C:\...\mosquitto\acl.acl If acl_file is set the auth_plugin check will be made first
@crotel
crotel / pretty-json
Created March 25, 2022 06:22 — forked from scottslowe/pretty-json
This output came from running the raw JSON-serialized response to a REST API through the python json.tool command.
{
"result_count": 3,
"results": [
{
"_href": "/ws.v1/lswitch/3ca2d5ef-6a0f-4392-9ec1-a6645234bc55",
"_schema": "/ws.v1/schema/LogicalSwitchConfig",
"type": "LogicalSwitchConfig"
},
{
"_href": "/ws.v1/lswitch/81f51868-2142-48a8-93ff-ef612249e025",

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.