This file contains hidden or 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
| cmake_minimum_required(VERSION 3.16) | |
| project(${PROJ}) | |
| set(CMAKE_CXX_STANDARD 20) | |
| find_package( OpenCV REQUIRED ) | |
| include_directories( ${OpenCV_INCLUDE_DIRS} ) | |
| add_executable(${PROJ} main.cpp) | |
| target_link_libraries( practice ${OpenCV_LIBS} ) |
This file contains hidden or 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 | |
| openssl genrsa -out rootkey.pem 2048 | |
| openssl req -x509 -new -key rootkey.pem -out root.crt | |
| openssl genrsa -out clientkey.pem 2048 | |
| openssl req -new -key clientkey.pem -out client.csr | |
| openssl x509 -req -in client.csr -CA root.crt -CAkey rootkey.pem -CAcreateserial -days 3650 -out client.crt | |
| openssl genrsa -out serverkey.pem 2048 | |
| openssl req -new -key serverkey.pem -out server.csr | |
| openssl x509 -req -in server.csr -CA root.crt -CAkey rootkey.pem -CAcreateserial -days 3650 -out server.crt | |
| openssl pkcs12 -export -in client.crt -inkey clientkey.pem -out client.pkcs12 |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <sys/socket.h> | |
| #include <resolv.h> | |
| #include <stdlib.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> | |
| #include <unistd.h> | |
| #include <openssl/ssl.h> |
This file contains hidden or 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
| func evpBytesToKey(password:String, keyLen:Int, ivLen:Int) -> ([UInt8], [UInt8]) { | |
| var m = [Data]() | |
| guard let passwd = password.data(using: String.Encoding.utf8) else { | |
| return ([], []); | |
| } | |
| while m.reduce(0, {$0 + $1.count}) < keyLen + ivLen { | |
| let data = m.count > 0 ? m.last! + passwd : passwd | |
| m.append(data.md5Digest()) | |
| } | |
| let final = m.reduce(Data(), +) |
This file contains hidden or 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 | |
| /* | |
| #cgo CFLAGS: -x objective-c | |
| #cgo LDFLAGS: -framework Cocoa | |
| #import <Cocoa/Cocoa.h> | |
| int | |
| StartApp(void) { | |
| [NSAutoreleasePool new]; | |
| [NSApplication sharedApplication]; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Redux basic example</title> | |
| <script src="https://npmcdn.com/jquery@2.2.4"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.js"></script> | |
| <script src="https://npmcdn.com/redux@latest/dist/redux.min.js"></script> | |
| </head> | |
| <body> | |
| <style> |
This file contains hidden or 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
| - (void)observeJSContext | |
| { | |
| CFRunLoopRef runLoop = CFRunLoopGetCurrent(); | |
| // This is a idle mode of RunLoop, when UIScrollView scrolls, it jumps into "UITrackingRunLoopMode" | |
| // and won't perform any cache task to keep a smooth scroll. | |
| CFStringRef runLoopMode = kCFRunLoopDefaultMode; | |
| CFRunLoopObserverRef observer = CFRunLoopObserverCreateWithHandler | |
| (kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, ^(CFRunLoopObserverRef observer, CFRunLoopActivity _) { |
This file contains hidden or 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
| send.rac_command = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) { | |
| NSDate *start = [NSDate date]; | |
| [send setAttributedTitle:[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%f s", 5.f] | |
| attributes:@{ | |
| NSFontAttributeName:[UIFont fontWithName:@"STHeitiSC-Medium" size:16], | |
| NSForegroundColorAttributeName:[UIColor blackColor] | |
| }] forState:UIControlStateNormal]; | |
| return [send rac_liftSelector:@selector(setAttributedTitle:forState:) | |
| withSignals: | |
| [[[[RACSignal interval:1 onScheduler:[RACScheduler currentScheduler]] |
This file contains hidden or 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 | |
| if ! which git >/dev/null; then | |
| sudo yum install git | |
| fi | |
| htname="alarm" | |
| git clone https://github.com/wxkingstar/dagger.git $htname | |
| cd $htname | |
| rm -rf ./InstallDaggerEnvironment.sh ./app ./js ./css ./images ./system ./model ./install ./index.php ./config | |
| git ls-files --deleted -z | git update-index --assume-unchanged -z --stdin | |
| git submodule add https://github.com/shuoshi/dagger_alarm.git ./alarm |