Skip to content

Instantly share code, notes, and snippets.

when CLIENT_ACCEPTED {
set proxyheader "PROXY TCP[IP::version] [IP::remote_addr] [IP::local_addr] [TCP::remote_port] [TCP::local_port]\r\n"
}
when SERVER_CONNECTED {
TCP::respond $proxyheader
}
@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active February 28, 2024 03:48 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@javilobo8
javilobo8 / download-file.js
Last active May 27, 2024 21:00
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active January 31, 2024 14:45
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@ammario
ammario / ipint.go
Last active May 25, 2024 21:43
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@adham90
adham90 / spacemacs-keybindings
Last active April 5, 2024 14:24
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@zjhiphop
zjhiphop / 分布式系统学习资料.md
Created July 23, 2015 06:13
分布式系统学习资料

##分布式系统(Distributed System)资料


#####希望转载的朋友,你可以不用联系我.但是一定要保留原文链接,因为这个项目还在继续也在不定期更新.希望看到文章的朋友能够学到更多.

介绍:这是一篇介绍在动态网络里面实现分布式系统重构的paper.论文的作者(导师)是MIT读博的时候是做分布式系统的研究的,现在在NUS带学生,不仅仅是分布式系统,还有无线网络.如果感兴趣可以去他的主页了解.

@Ulu2005
Ulu2005 / cmu_course.md
Created July 13, 2015 21:45
CMU CS Course Info

#CMU Course Info 整理自一亩三分地

##08722 – Data Structurefor application programmers 这门课主要是开给EBIZ和MISM的,在MISM那边的课号是95772. 但是很多ECE, INI的同学,以及咱ME转CS帮都在上这门课。这门课只有半学期,一共6个credits,相当于1.5学分。内容非常基础,但是我觉得帮助挺大的,对于非CS科班出身想转CS的同学非常建议上一下, 基础越弱收获越大,要是基础比较硬的话就不用上了。LZ上的其它CS的课几乎都是各种牛校的PHD出身,这门课的老师好像都没有PHD学位,肯定没法去上15的课,但是讲课挺用心,讲的也很清楚。讲课这东西真的不是老师自己越牛就讲的越好。尤其数据结构这种比较基础的内容。这门课从最简单的内容讲起,包括array, arraylist, linked list, stack, queue,sorting(bubble, selection, insertion, merge, quick, heap), hashTable, hashMap,hashSet, BST, TreeMap, TreeSet, Huffman coding, Heap. 每周一次quiz, lab, homework。讲的时候内容都围绕Java Collection 来讲,还涉及与collection有关的comparator, iterator 等内容。这门课完全就是针对面试的,作业要求先手写代码(虽然大部分时候都是先ECLIPSE敲好再抄到纸上的)。

6次homework,前面的非常简单,后面稍微麻烦一点,难度都不大,就是让你去熟悉这些数据结构能自己implement,也能用JAVA COLLECTION。

  1. 自己implement 一个 arraylist 实现各种要求
  2. Queue, stack 的implement和应用