Skip to content

Instantly share code, notes, and snippets.

View MewX's full-sized avatar
🙀
Backing to the office!

MewX MewX

🙀
Backing to the office!
View GitHub Profile
@MewX
MewX / 2samples.md
Last active January 5, 2016 15:54
Lua on Android
  1. 创建android项目,在asset资源文件夹下创建一个lua文件夹
  2. 新建一个lua文件,放到 asset\lua目录下,如asset\lua\hello.lua。

file1.lua

一个简单的函数,计算两个数相加

function plus(a, b) 
    return a + b;

end

package com.example.speccall.lua;
import org.keplerproject.luajava.LuaObject;
import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
@MewX
MewX / Erya2015.py
Created April 6, 2016 07:39
之前用于“安小理”的服务端代码 =。= 因为新浪云一天扣我34个云豆,我决定关闭服务!
# -*- coding:utf-8 -*-
import MySQLdb
import sae.const
import urllib2,httplib,urllib,sys
from cgi import parse_qs, escape
html_front = '''
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@MewX
MewX / demo.cpp
Created April 10, 2016 16:42
Animation Images on top of windows
#include <windows.h>
#include <gdiplus.h>
#include <atlbase.h>
#pragma comment(lib,"gdiplus.lib")
/* GDI+ startup token */
ULONG_PTR gdiplusStartupToken;
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
@MewX
MewX / dailypush.sh
Created May 13, 2016 07:05
Daily push script for Coding.net coin, but it's useless now.
# add key
cd /root/documents/coding/test
eval `ssh-agent -s`
ssh-add ../rsa.key
# master push
git checkout master
git pull
#date > date.txt
#git add --all
@MewX
MewX / Main.java
Last active June 6, 2016 15:08
<海市蜃楼之馆> translated scripts tool.
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
// command: java Main omake.txt omake翻.txt scenario7.txt scenario7翻.txt
// args: f_jpn1, f_chs1, f_jpn2, f_chs2...
for (String a : args) {
@MewX
MewX / primes.c
Created February 11, 2017 01:14
Prime number table, just pick what you want, and you can calculate the length of the array by counting ','. ;D
const int primesLength = 10000;
const int primes[] = {
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
@MewX
MewX / ean13.c
Created February 26, 2017 13:56
EAN13 Generator (Win32 API in C)
/**
* Name : EAN13 Generator
* Author: MewX
* Date : 2014.11.25
**/
#include <windows.h>
#include <string.h>
#include <stdio.h>
@MewX
MewX / aes-naive.c
Last active September 1, 2017 10:18
Measure on AES on MSP430. (Codes based on and https://github.com/madmo/speck) Only modified codes are here.
/* aes-naive.c
* msp430 crypto librarie
* Written by Paul Ferrand <paul.ferrand@insa-lyon.fr>
*/
#include "aes-naive.h"
#include "tools.h"
#include <string.h>
#ifdef STATIC_LOGTABLES
@MewX
MewX / lblock.c
Last active September 1, 2017 10:45
Measures on some algorithms for MSP430. (based on: https://github.com/kmarquet/bloc)
#include <msp430.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "tools.h"
typedef uint16_t u16;
typedef uint8_t u8;
#define NBROUND 32