I hereby claim:
- I am victorzhang2014 on github.
- I am victor_zhang (https://keybase.io/victor_zhang) on keybase.
- I have a public key ASB-f57gfmokTjmPtHXnWD7aqKhYXneMfovhWxiZFIMBwQo
To claim this, I am signing this object:
#include <zlib.h> | |
#include <sstream> | |
/** Compress a STL string using zlib with given compression level and return | |
* the binary data. | |
https://panthema.net/2007/0328-ZLibString.html | |
*/ | |
std::string VLUtilitiesEncoding::compress(const std::string & str, int compressionlevel = Z_BEST_COMPRESSION) | |
{ | |
z_stream zs; // z_stream is zlib's control structure |
#import <Foundation/Foundation.h> | |
@interface RSACryptographic : NSObject | |
- (void)loadPublicKeyFromFile:(NSString*)derFilePath; | |
- (void)loadPublicKeyFromData:(NSData*)derData; | |
- (void)loadPrivateKeyFromFile:(NSString*)p12FilePath password:(NSString*)p12Password; | |
- (void)loadPrivateKeyFromData:(NSData*)p12Data password:(NSString*)p12Password; |
/// <summary> | |
/// Create public key/private key file, actually, the original certificates was modified to a XML file | |
/// 创建公钥/私钥文件,其实就是把原有的证书的内容修改成XML格式的 | |
/// </summary> | |
public static void CreateCertificateKeyXML(string path, string key) | |
{ | |
try | |
{ | |
FileStream keyxml = new FileStream(path, FileMode.Create); | |
StreamWriter sw = new StreamWriter(keyxml); |
//This file is encrypt/decrypt data in a default way which can not decrypt/decrypt a chunk of data | |
using System; | |
using System.Text; | |
using System.Security.Cryptography; | |
using System.Security.Cryptography.X509Certificates; | |
namespace RSA_CSharp_Example | |
{ | |
class Program |
#import <Foundation/Foundation.h> | |
@interface RSACryptographic : NSObject | |
- (void)loadPublicKeyFromFile:(NSString*)derFilePath; | |
- (void)loadPublicKeyFromData:(NSData*)derData; | |
- (void)loadPrivateKeyFromFile:(NSString*)p12FilePath password:(NSString*)p12Password; | |
- (void)loadPrivateKeyFromData:(NSData*)p12Data password:(NSString*)p12Password; |
#import "VLAudioSoundControl.h" | |
@implementation VLAudioSoundControl | |
+ (void)RingTone:(NSString *)ringName type:(NSString *)type { | |
[self pauseBackgroundSoundWithError:nil]; | |
SystemSoundID send_voice_sound_id = 0; | |
//Load sound file |
+ (void)test { | |
NSString *zhua = @"zhuā"; | |
NSString *tong = @"tóng"; | |
NSString *bie = @"biě"; | |
NSString *yi = @"yì"; | |
int zhuaPosition = [self detectDiacriticsPosition:zhua]; // 输出1 | |
NSLog(@"%@%d", zhua, zhuaPosition); | |
int tongPosition = [self detectDiacriticsPosition:tong]; // 输出2 |
I hereby claim:
To claim this, I am signing this object:
import threading | |
# A thread-safe implementation of Singleton pattern | |
# To be used as mixin or base class | |
class Singleton(object): | |
# use special name mangling for private class-level lock | |
# we don't want a global lock for all the classes that use Singleton | |
# each class should have its own lock to reduce locking contention | |
__lock = threading.Lock() |
// https://stackoverflow.com/questions/21731044/is-there-a-way-to-attach-an-event-handler-to-the-list-of-running-processes-in-c | |
// | |
static void Main(string[] args) | |
{ | |
var query = new EventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance isa \"Win32_Process\""); | |
using (var eventWatcher = new ManagementEventWatcher(query)) | |
{ | |
eventWatcher.EventArrived += eventWatcher_EventArrived; | |
eventWatcher.Start(); |