Skip to content

Instantly share code, notes, and snippets.

View code-brewer's full-sized avatar

wangyouhua code-brewer

View GitHub Profile
@code-brewer
code-brewer / README.md
Created December 11, 2023 14:36 — forked from mattmc3/README.md
zsh: zstyle examples

zstyle booleans

Setup foo,bar,baz boolean vars

zstyle ':example:foo' doit yes
zstyle ':example:bar' doit no
# leave baz unset
@code-brewer
code-brewer / golang-tls.md
Created November 22, 2022 01:41 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@code-brewer
code-brewer / README.md
Created November 22, 2022 01:11 — forked from anhldbk/README.md
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

@code-brewer
code-brewer / gist:5f198f0541a1ab854448e80f726f7632
Created May 18, 2022 15:51 — forked from mikehaertl/gist:3258427
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
@code-brewer
code-brewer / mintNFT.js
Created February 21, 2022 06:58 — forked from lovalabs/mintNFT.js
Minimal Cardano NFT Mint Example using CSL
import { Vkeywitness } from '@emurgo/cardano-serialization-lib-nodejs'
import CoinSelection from './coinSelection.js'
import {getUtxos, newTxBuilder, signTx, submitTx, bytesToString, getProtocolParameters, waitForConfirmation} from './util.js'
const S = await import('@emurgo/cardano-serialization-lib-nodejs/cardano_serialization_lib.js')
const Buffer = (await import('buffer/')).Buffer
// WARNING no coin selection algorithm is being used
// for this to be used seriously, consider using randomImprove or similar
// ADDITIONALLY: we make no attempt to split transactions in case this will be too large for a single tx
// see Nami's implementation of tx balancing to solve this.
@code-brewer
code-brewer / RealmWrapper.md
Created April 15, 2019 02:13 — forked from codeopensrc/RealmWrapper.md
A javascript wrapper for the RealmDB node module used in React Native.

My RealmWrapper.js file. Uses RealmSchema.js for the schema.

You can find the "realmSchema.js" here and examples here

'use strict';

import Realm from 'realm';
import Schemas from "./realmSchemas.js";
const version = 51;
@code-brewer
code-brewer / pom.xml
Created April 1, 2019 07:50 — forked from mnadeem/pom.xml
Add non maven jar in maven way
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.app</groupId>
<artifactId>demo-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<version.maven-install-plugin>2.5.2</version.maven-install-plugin>
<version.non-maven1>1.0.0</version.non-maven1>
@code-brewer
code-brewer / gist:e62487e88d2b51314453867a3f72315f
Created March 16, 2018 06:31 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*