Skip to content

Instantly share code, notes, and snippets.

View jeremy5189's full-sized avatar

Jeremy Yen jeremy5189

View GitHub Profile
#define BUTTON0 0x2B940BF
#define BUTTON1 0x2B9C03F
#define BUTTON2 0x2B958A7
#define BUTTON3 0x2B920DF
#define BUTTON4 0x2B9A05F
#define BUTTON5 0x2B9609F
#define BUTTON6 0x2B97887
#define BUTTON7 0x2B9E01F
#define BUTTON8 0x2B910EF
#define BUTTON9 0x2B9906F
/* --------------------------------
* NTUST 學生資訊系統 平均 GPA 計算
*
* 作者:Eric Ping
* 更新:Jeremy Yen
*
* Change Log
* - 修正「二次退選」所造成之問題
* - 增加 B99 百分制成績支援
* - 使用正規表達式判斷中文與數字
@jeremy5189
jeremy5189 / simple-rsa.py
Last active April 12, 2024 14:10
利用 Python 實作簡易 RSA 非對稱式加密法
#!/usr/bin/python
# -*- coding: utf8 -*-
# Simple RSA Implementation
# Authored by Jeremy <jeremy5189(at)gmail.com>
# Reference: http://www.ruanyifeng.com/blog/2013/07/rsa_algorithm_part_two.html
from fractions import gcd
import sys
#define BUTTON0 0x910
#define BUTTON1 0x10
#define BUTTON2 0x810
#define BUTTON3 0x410
#define BUTTON4 0xC10
#define BUTTON5 0x210
#define BUTTON6 0xA10
#define BUTTON7 0x610
#define BUTTON8 0xE10
#define BUTTON9 0x110
int isPrime( int n ) {
if( n <= 2 )
return true;
else if( n % 2 == 0 )
return false;
else {
int i, sn = (int)sqrt((double)n) + 1;
/*
* =====================================================
*
* Filename: prime.c
*
* Version: 1.0
* Created: 2014/03/06 13時47分52秒
* Revision: none
* Compiler: gcc
*
#!/usb/bin/python
import sys
if len(sys.argv) < 5:
hex_uid = sys.argv[1]
hex_uid = hex_uid[6:8] + hex_uid[4:6] + hex_uid[2:4] + hex_uid[:2]
else:
hex_uid = sys.argv[4] + sys.argv[3] + sys.argv[2] + sys.argv[1]
print int(hex_uid, 16);
/*
* =====================================================================================
*
* Filename: base64.c
*
* Description: Perform Base64 String Encode & Decode
*
* Version: 1.0
* Created: 2014/04/12 19時08分52秒
* Revision: none
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void print_array( vector<int> list ) {
vector<int>::iterator it;
do {
/* MD5
converted to C++ class by Frank Thilo ([email protected])
for bzflag (http://www.bzflag.org)
based on:
md5.h and md5.c
reference implemantion of RFC 1321
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All