Skip to content

Instantly share code, notes, and snippets.

@magic0524
magic0524 / tmux-cheatsheet.markdown
Created September 11, 2018 06:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@magic0524
magic0524 / Base64.md
Created September 14, 2017 02:56 — forked from barrysteyn/Base64.md
OpenSSL Base64 En/Decode: Portable and binary safe.

OpenSSL Base64 Encoding: Binary Safe and Portable

Herewith is an example of encoding to and from base64 using OpenSSL's C library. Code presented here is both binary safe, and portable (i.e. it should work on any Posix compliant system e.g. FreeBSD and Linux).

License

The MIT License (MIT)

Copyright (c) 2013 Barry Steyn

void TCPConnection::Notify(Loop* loop, int events) {
static const size_t kMaxBufSize = 4096;
char buffer[kMaxBufSize];
int res;
if (events & kLoopErr) {
Close();
} else {
if (events & kLoopOut) {
int res = SendInLoop();
BIN=main
SRC=src \
third_party
CC=gcc
CXX=g++
CFLAGS=-g
CXXFLAGS=-g -std=c++11
LD=g++
LDFLAGS=
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
double hongbao(double m, int n) {
double x = m - (double)n * 0.01;
x = m / (double)n;
if (n != 1 || x > 0.01) {
double y = rand() % 200 / 100.0;
x *= y;
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
int match(int *arr, size_t len, int *arr_input, size_t len_input, int *seq) {
int found = 0;
for (int i = 0; i < len_input; ++i) {
if (arr[arr_input[i]]) {
found = arr[arr_input[i]];
break;
import scrapy
from scrapy.http.request import Request
class xxxxSpider(scrapy.Spider):
main_url = "http://www.xxxxx.com";
name = "soda"
allowed_domains = ["www.xxxxx.com"]
start_urls = [
main_url + "xxxxx.html"
]
@magic0524
magic0524 / node_js_mysql_redis
Created May 12, 2015 16:18
Node.js + MySql + Redis
var version = '0.1',
httpport = 8765;
var express = require('express'),
compression = require('compression'),
redis = require('redis'),
mysql = require('mysql');
var app = express();
app.use(compression());