Skip to content

Instantly share code, notes, and snippets.

View shangzongyu's full-sized avatar
💭
I may be slow to respond.

TomShine shangzongyu

💭
I may be slow to respond.
View GitHub Profile
@shangzongyu
shangzongyu / makefile
Last active January 13, 2021 02:59 — forked from sohlich/makefile
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMODE=$(GOCMD) mod
BINARY_NAME=mybinary
BINARY_UNIX=$(BINARY_NAME)_unix
BINARY_MACOS=$(BINARY_NAME)_darwin
@shangzongyu
shangzongyu / sublime-text-3-setup.md
Created July 29, 2019 05:14 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@shangzongyu
shangzongyu / Sublime Settings.md
Created July 28, 2019 09:26 — forked from mihirsoni/Sublime Settings.md
My Sublime Text Config

A fresh Installation for Sublime Text

  • Download and install Sublime Text 3

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@shangzongyu
shangzongyu / Python TCP Client Example.py
Created April 26, 2019 09:21 — forked from Integralist/Python TCP Client Example.py
Python TCP Client Server Example
import socket
hostname, sld, tld, port = 'www', 'integralist', 'co.uk', 80
target = '{}.{}.{}'.format(hostname, sld, tld)
# create an ipv4 (AF_INET) socket object using the tcp protocol (SOCK_STREAM)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect the client
# client.connect((target, port))
@shangzongyu
shangzongyu / go-os-arch.md
Last active December 29, 2018 09:06 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin

Export from evernote

You’ll have to open up the evernote application on either Mac or Windows (they don’t have a linux client), right click on the notebook you want to export, and select “Export.” Select the option to export to html (either one page or several pages, depending on your preference. I went with one html page for each note).

Clean filenames

@shangzongyu
shangzongyu / delete_git_submodule.md
Created November 23, 2018 09:40 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@shangzongyu
shangzongyu / golang-tls.md
Created November 8, 2018 02:38 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
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)
@shangzongyu
shangzongyu / udpclient.c
Created November 7, 2018 03:15
udp client in C
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>
#include <stdlib.h>
#include <arpa/inet.h>
int main(int argc,char **argv)
@shangzongyu
shangzongyu / udpserv.c
Last active November 7, 2018 03:13 — forked from miekg/udpserv.c
udp server in C
/*
* udpserver.c - A simple UDP echo server
* usage: udpserver <port>
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>