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
LEAK_CHECK_CP=$(grep "definitely lost:" %X86_64_BUILD_DIR_NAME%/leak_check_cp --after-context=2 | tr '\n' ' ' | sed -e 's/^==[0-9]*==\s*//' | sed -e 's/\s*==[0-9]*==\s*/ | /g' | sed -e 's/in\s[0-9]*\sblocks//g') | |
LEAK_CHECK_EN=$(grep "definitely lost:" %X86_64_BUILD_DIR_NAME%/leak_check_en --after-context=2 | tr '\n' ' ' | sed -e 's/^==[0-9]*==\s*//' | sed -e 's/\s*==[0-9]*==\s*/ | /g' | sed -e 's/in\s[0-9]*\sblocks//g') | |
LEAK_CHECK_VR=$(grep "definitely lost:" %X86_64_BUILD_DIR_NAME%/leak_check_vr --after-context=2 | tr '\n' ' ' | sed -e 's/^==[0-9]*==\s*//' | sed -e 's/\s*==[0-9]*==\s*/ | /g' | sed -e 's/in\s[0-9]*\sblocks//g') |
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
require 'aws-sdk-s3' | |
require 'net/http' | |
require 'pry' | |
s3 = Aws::S3::Resource.new(region:'ap-northeast-1') | |
obj = s3.bucket('threal-test').object('only_1_min') | |
# Replace BucketName with the name of your bucket. | |
# Replace KeyName with the name of the object you are creating or replacing. | |
url = URI.parse(obj.presigned_url(:put, expires_in: 3600)) |
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 gemm4x4_vec(float *a, int sa, float *b, int sb, float *c, int sc) | |
{ | |
// vaddq_f32 | |
// vmulq_f32 | |
// vld1q_f32(a) | |
float32x4_t vb[4]; | |
size_t x, y, k; | |
for(int i=0; i<4; i++){ |
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 <stdlib.h> | |
#include <math.h> | |
int main(){ | |
// Check float and character size | |
if (sizeof(float) != 4){ | |
printf("Float is not 32 bits on your machine!"); | |
exit(-1); | |
} |
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 <math.h> | |
int main(){ | |
float f1 = 2.999999; | |
float f2 = 2.9999999; | |
printf("floor(f1), 20 digital points: %10.20f\n", floor(f1)); | |
printf("floor(f2), 20 digital points: %10.20f\n", floor(f2)); | |
} |
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
import qrcode | |
f = open('qrcode.txt') | |
for line in f: | |
line = line.strip() | |
qr = qrcode.QRCode( | |
version=4, | |
error_correction=qrcode.constants.ERROR_CORRECT_L, |
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
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb | |
# Maps logical Rails types to MySQL-specific data types. | |
def type_to_sql(type, limit = nil, precision = nil, scale = nil) | |
return super unless type.to_s == 'integer' | |
case limit | |
when 1; 'tinyint' | |
when 2; 'smallint' | |
when 3; 'mediumint' | |
when nil, 4, 11; 'int(11)' # compatibility with MySQL default |
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
# /etc/monit/conf.d/ | |
check process redis-master | |
with pidfile "/var/run/redis/redis-master.pid" | |
start program = "/usr/local/bin/redis-server /etc/redis/redis-master.conf" | |
stop program = "/usr/local/bin/redis-cli -p 6379 shutdown" | |
check process redis-slave-1 | |
with pidfile "/var/run/redis/redis-slave-1.pid" | |
start program = "/usr/local/bin/redis-server /etc/redis/redis-slave-1.conf" | |
stop program = "/usr/local/bin/redis-cli -p 6380 shutdown" | |
check process redis-store |
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
range1 = 0...50_000_000 | |
range2 = 50_000_000...100_000_000 | |
number = 99_999_999 | |
puts "Parent #{Process.pid}" | |
fork { puts "Child1 #{Process.pid}: #{range1.to_a.index(number)}" } | |
fork { puts "Child2 #{Process.pid}: #{range2.to_a.index(number)}" } | |
Process.wait | |
# time ruby parallel.rb | |
# parent 20434 |
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
user www-data; | |
# worker數量,與核心數同 | |
worker_processes 4; | |
pid /run/nginx.pid; | |
# Number of file descriptors used for Nginx. This is set in the OS with 'ulimit -n 200000' | |
# or using /etc/security/limits.conf | |
#一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(系统的值ulimit -n)与nginx进程数相除,但是nginx分配请求并不均匀,所以建议与ulimit -n的值保持一致. | |
worker_rlimit_nofile 65535; |
NewerOlder