Skip to content

Instantly share code, notes, and snippets.

View mingtsay's full-sized avatar
🇹🇼

Ming Tsay mingtsay

🇹🇼
View GitHub Profile
<?php
$conn = new PDO("mysql:host=127.0.0.1;dbname=rfid;", "root", "");
$cursor = $conn->prepare("select * from :table ;");
//$cursor->execute(array(":table"=>"contrast"));
$cursor->bindValue(":table", "contrast");
$cursor->execute();
var_dump($cursor->fetch());
// var_dump($cursor);
@mingtsay
mingtsay / ch2nato.js
Last active October 27, 2021 09:58
NATO phonetic alphabet
function ch2nato(ch) {
switch (ch.toLowerCase()) {
case "a": return "ALPHA";
case "b": return "BRAVO";
case "c": return "CHARLIE";
case "d": return "DELTA";
case "e": return "ECHO";
case "f": return "FOXTROT";
case "g": return "GOLF";
case "h": return "HOTEL";
Array.prototype.sayHi = function () {
var say = 'Hi, ' + this.join(', ') + '!';
window.alert(say);
}
var a = ['Bob', 'Alice', 'Emma'];
a.sayHi(); // this will alert: Hi, Bob, Alice, Emma!
for (var i in a) {
console.log(i, a.hasOwnProperty(i), a[i]);
setInterval(function () {
// 取得網頁上所有連結
var a = document.getElementsByTagName('a');
// 針對每個連結跑一次
for (var i in a) {
// 檢查是不是真的是連結
if (a.hasOwnProperty(i)) {
// 檢查是不是讚的連結
if (a[i].className == "UFILikeLink") {
// 檢查是不是還沒按過讚
@mingtsay
mingtsay / mcu_moodle_form.js
Last active August 29, 2015 14:01
for MCU Moodle form 5 stars and check all boxes
(function(d){
var f = d.getElementById("phpesp_response");
for (var i in f) {
if (f[i]) {
switch (f[i].type) {
case "radio":
if (f[i].value == 4) {
f[i].checked = true;
}
break;
@mingtsay
mingtsay / oppose_cheat.js
Last active August 29, 2015 13:58 — forked from anonymous/oppose_cheat.js
Cheat script for www.oppose.tw
(function() {
$btnYes = $('.btn-yes')[0];
$btnNo = $('.btn-no' )[0];
$content = $('.show-content')[0];
function cheat() {
if (l = $content.innerHTML.length) {
l % 2 ? $btnNo.click() : $btnYes.click();
}
setTimeout(cheat);
//
// Include keys file
//
include "/etc/rndc.key";
// Declares control channels to be used by the rndc utility.
//
// It is recommended that 127.0.0.1 be the only address used.
// This also allows non-privileged users on the local host to manage
// your name server.
Office 2010 Professional Plus 正體中文
32位元:https://mega.co.nz/#!UF5EVCCa!Pk9DPCndWJk3Ho3bqXsHtEk1Ijd5yr7fHP6Pn54fgFk
64位元:https://mega.co.nz/#!dIgzCYKQ!T57WuG6NyoeLzsIB_eA3bAdU0EgDhQYyqAm2TK6qNe4
KMS破解:https://mega.co.nz/#!xF5xAbKa!AUQu8gO9NVzyzuZapqsPdVz3FSgkSIln-gxDiK9XXcE
破解教學:
1.執行 mini-KMS Activator
(Do you run the program as Administrator? [Yes])
2.安裝 KMService
@mingtsay
mingtsay / roman.cpp
Last active December 18, 2015 22:48
#include <iostream>
#include <string>
#define N 7
using namespace std;
// 建立羅馬數字與十進位相對應的陣列資料
char roman[N] = {'M', 'D', 'C', 'L', 'X', 'V', 'I'};
int arabic[N] = {1000, 500, 100, 50, 10, 5, 1};
@mingtsay
mingtsay / d693.c
Last active December 12, 2015 03:38
GCD & LCM Reference
#include <stdio.h>
int gcd(int a, int b)
{
int m;
while(b)
{
m = b;
b = a % b;
a = m;