This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jsoniter "github.com/json-iterator/go" | |
type NotOmitemptyValEncoder struct { | |
encoder jsoniter.ValEncoder | |
} | |
func (codec *NotOmitemptyValEncoder) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) { | |
codec.encoder.Encode(ptr, stream) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"compress/flate" | |
"compress/gzip" | |
"compress/zlib" | |
"io/ioutil" | |
"math/rand" | |
"testing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MariaDB [phone_property]> show variables like '%log_bin%'; | |
+----------------------------------+-------+ | |
| Variable_name | Value | | |
+----------------------------------+-------+ | |
| forbid_remote_change_sql_log_bin | ON | | |
| log_bin | ON | | |
| log_bin_trust_function_creators | ON | | |
| sql_log_bin | ON | | |
+----------------------------------+-------+ | |
4 rows in set (0.00 sec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Reference https://github.com/microsoft/vscode-remote-release/issues/680 | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 sha" | |
echo "Demo: $0 26076a4de974ead31f97692a0d32f90d735645c0" | |
exit 0 | |
fi | |
sha=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// watches the source directory for changes and synchronize to destination directory | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"path/filepath" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from functools import wraps | |
from bottle import request | |
def login(): | |
def decorator(func): | |
@wraps(func) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RepeatingTimer(_Timer): | |
def __init__(self, init_delay, interval, function, args=[], kwargs={}): | |
_Timer.__init__(self, interval, function, *args, **kwargs) | |
self.init_delay = init_delay | |
def run(self): | |
self.finished.wait(self.init_delay) | |
self.function(*self.args, **self.kwargs) | |
while not self.finished.is_set(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import * | |
from bottlepy_user_auth import User | |
def validate_login(): | |
return User().loggedin | |
def login_required(view, check_func=validate_login): | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __RESULT_CODE__ | |
#define __RESULT_CODE__ | |
#include <string> | |
#include <iostream> | |
using std::string; | |
using std::ostream; | |
namespace Result | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
demo | |
*.swp |
NewerOlder