Skip to content

Instantly share code, notes, and snippets.

View g10guang's full-sized avatar
🤑
Running On My Way

Liu XiGuang g10guang

🤑
Running On My Way
View GitHub Profile
@rajkrrsingh
rajkrrsingh / Google protobuf installation on Mac
Created November 27, 2016 10:57
Steps to Install google protobuf on Mac
$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
$make -j 4
$sudo make install
$protoc --version
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@dtoma
dtoma / epoll_server.py
Last active January 30, 2024 05:12
epoll tcp server in python
#!/usr/bin/env python
"""Simple server using epoll."""
from __future__ import print_function
from contextlib import contextmanager
import socket
import select
@denji
denji / golang-tls.md
Last active March 29, 2024 03:03 — forked from spikebike/client.go
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)
@jtbonhomme
jtbonhomme / nc.md
Last active April 2, 2024 10:57
Using Netcat for File Transfers

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file 
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active February 1, 2024 20:14
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"
@manishtpatel
manishtpatel / main.go
Last active October 18, 2023 03:12
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@phuesler
phuesler / netcat_tcp_server.sh
Last active February 29, 2024 23:55
Simple tcp server using netcat
#!/bin/bash
# Simple tcp server using netcat
# - depending on the netcat version either use nc -l 5555 or nc -l -p 5555
# - verify with `telnet locahhost 5555`
# - quit the telnet with `ctrl-]` and then type quit
# - the while loop is there so reopen the port after a client has disconnected
# - supports only one client at a time
PORT=5555;
while :; do nc -l -p $PORT | tee output.log; sleep 1; done
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl