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
| <?php | |
| // DEFINE our cipher | |
| define('AES_256_CBC', 'aes-256-cbc'); | |
| // Generate a 256-bit encryption key | |
| // This should be stored somewhere instead of recreating it each time | |
| $encryption_key = openssl_random_pseudo_bytes(32); | |
| // Generate an initialization vector | |
| // This *MUST* be available for decryption as well |
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> | |
| void func(int []); | |
| int main() | |
| { | |
| int a[2] = {3,6}; | |
| printf("Original %d %d\n", a[0], a[1]); | |
| func(a); |
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> | |
| void Function(int c[2][2]); | |
| int main(){ | |
| int c[2][2],i,j; | |
| printf("Enter 4 numbers:\n"); | |
| for(i=0;i<2;++i) | |
| for(j=0;j<2;++j){ | |
| scanf("%d",&c[i][j]); |
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 <Wire.h> | |
| byte i2cdata[4]; | |
| void setup() { | |
| Wire.begin(); | |
| Serial.begin(9600); | |
| } | |
| void loop() { |
這篇文章寫到最後才發現 Cloudflare 自己就已經提供免費的 SSL 可以使用,如果你已經有在用 (真的蠻好用的,重點是永久免費),所以可以先直接往下滑找到 設定 Cloudflare 的 SSL 模式 區塊看看
之前有用過 StarSSL 來作為 SSL for https 的 CA,原因當然是因為不用錢 (好像是永久免費,每年 renew 一次即可),但是使用後發現他的免費憑證 (Class 1) 在手機上還是會顯示出無法驗證憑證的訊息,所以就放棄使用 https 了
之前 Github 推出 Student Developer Pack 提供給窮學生們免費使用各種付費服務,其中有 VPS by Digital Ocean, Domain name by namecheap and SSL by namecheap,最近正好想到 中興大學學生會 ILT 會員系統 理論上必須要架設在 https 環境下使用,今天就是要來使用 PositiveSSL by namecheap 把原本沒有 SSL 的 ILT 系統加上 SSL 使之更安全
這個簡單的教學只是把我申請、設定的過程記錄下來而已,在開始前已經
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
| <?php | |
| function json_response($code = 200, $message = null) | |
| { | |
| // clear the old headers | |
| header_remove(); | |
| // set the actual code | |
| http_response_code($code); | |
| // set the header to make sure cache is forced | |
| header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); |
接龍啊…
小測資照著題目做就可以過,但大測資不行,必須優化,可以優化成 O(n)。
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
| #define _CRT_SECURE_NO_WARNINGS | |
| #include <map> | |
| #include <set> | |
| #include <queue> | |
| #include <stack> | |
| #include <bitset> | |
| #include <time.h> | |
| #include <string> | |
| #include <vector> | |
| #include <math.h> |