Skip to content

Instantly share code, notes, and snippets.

View tsingson's full-sized avatar
🏠
Working from home

tsingson tsingson

🏠
Working from home
View GitHub Profile
@tsingson
tsingson / ffmpeg_test.go
Created August 22, 2022 13:16 — forked from mattli001/ffmpeg_test.go
golang test ffmpeg example
package ffmpeg
import (
"bytes"
"context"
"io"
"os"
"os/exec"
"strings"
"testing"

mTLS 配置

对于mTLS的配置的证书来说,有如下的提示。

  • 三个文件。 对于大多数系统,如:MySQL, Redis,PostgreSQL。会需要三个文件:CA证书 + CERT 和 KEY。可以在我的这个开源项目(https://github.com/haoel/mTLS/tree/main/certs )中找到我生成的CA,以及 Server 和 Client的 .crt.key 文件。生成的方法也在我的那个开源项目中了。

  • 两个文件。 对于有的系统,比如:MongoDB,他只要两个文件,一个是CA,一个是 pem 文件,对于pem文件,你可以直接把上面的 .crt 和 .key 合并了就好了。如:cat server.crt server.key > server.pem

  • JKS文件。 对于一些系统,比如:Kafka 和 Zookeeper。他要的不是上面的明文的格式,他要的是一种jks的格式,这是Java的格式。怎么从上面的明文的方式转到jks的文件。需要经过下面几步。

@tsingson
tsingson / valtio-promise.js
Created March 27, 2022 23:15 — forked from anthowave/valtio-promise.js
Valtio(proxy-based state management library) demo that natively handles promise with React suspense
import React, { Suspense } from "react";
import { proxy, useProxy } from "valtio";
import { a, useSpring } from "@react-spring/web";
const fetchData = async (id) => {
const response = await fetch(
`https://hacker-news.firebaseio.com/v0/item/${id}.json`
);
return await response.json();
};
@tsingson
tsingson / README.md
Created March 22, 2022 06:03 — forked from joseluisq/README.md
Install and configure Traefik as Reserver Proxy in a non-docker environment.

Traefik as Reserver Proxy in RHE/CentOS 7

Install and configure Traefik as Reserver Proxy in a non-docker environment.

Donwload and install Traefik

curl -L https://github.com/containous/traefik/releases/download/v1.7.12/traefik_linux-amd64 -o /usr/local/bin/traefik
chmod +x /usr/local/bin/traefik
@tsingson
tsingson / postgres-brew.md
Created February 28, 2022 09:28 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@tsingson
tsingson / datagrip_sql_format.xml
Created July 18, 2018 09:04
jetbrains datagrip's sql format define
<code_scheme name="sqlTsingson" version="173">
<SqlCodeStyleSettings version="1">
<option name="ALIAS_CASE" value="4" />
<option name="KEYWORD_CASE" value="0" />
<option name="TYPE_CASE" value="3" />
<option name="QUERY_IN_ONE_STRING" value="1" />
<option name="SUBQUERY_R_PAR_NL_INSIDE" value="true" />
<option name="SUBQUERY_R_PAR_ALIGN" value="0" />
<option name="SUBQUERY_INDENT_INSIDE" value="true" />
<option name="SUBQUERY_PAR_SPACE_INSIDE" value="true" />
@tsingson
tsingson / macapp.go
Created June 6, 2018 22:40 — forked from mholt/macapp.go
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@tsingson
tsingson / app.jsx
Created May 22, 2015 16:52
webpack-babel-react
import "./index.html";
import "./css/app.css";
var React = require('react');
var TodoApp = require('./components/TodoApp.react');
React.render(
<TodoApp />,
document.getElementById('app')
import React, { Component } from 'react';
import Router, { Route, DefaultRoute, RouteHandler, Link } from 'react-router';
var data = require('./data');
class Item extends Component {
constructor(props,context) {
super(props);
//this.state = this.getStateFromStore();