Skip to content

Instantly share code, notes, and snippets.

凯东 toinetoine

Block or report user

Report or block toinetoine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CorsStuff.java
private static final HashMap<String, String> corsHeaders = new HashMap<String, String>();
static {
corsHeaders.put("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
corsHeaders.put("Access-Control-Allow-Origin", "*");
corsHeaders.put("Access-Control-Allow-Headers", "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin,");
corsHeaders.put("Access-Control-Allow-Credentials", "true");
}
public final static void apply() {
View SzTong.sol
pragma solidity ^0.4.23;
contract ShenzhenTong {
address public owner; // 合同创新的人
uint public feePerStation; // 每站费用
// 每个卡的账户余额
mapping (address => uint) public card_balances;
string[] public stations;
View bitcoin_miner.cpp
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <openssl/sha.h>
#include <unistd.h> // for sleep
using namespace std;
View Splice.java
public static int[] splice(int a[], int offset, int b[]) {
int[] resultArray = new int[a.length + b.length];
for(int i = 0; i < resultArray.length; i++) {
if (i < offset) { // before the part b should be copied to
resultArray[i] = a[i];
}
else if (i - offset < b.length) { // in the middle of the part b is copied to
resultArray[i] = b[i - offset];
}
@toinetoine
toinetoine / WithKoogra
Created Jun 10, 2016
Reading .NET worksheets with Koogra
View WithKoogra
Koogra.IWorkbook workbook = Koogra.WorkbookFactory.GetExcel2007Reader(excelFileBrowserDialog.FileName);
Koogra.IWorksheet worksheet = workbook.Worksheets.GetWorksheetByName(sheetName);
return (string)(worksheet.Rows.GetRow(0).GetCell(0).GetFormattedValue());
@toinetoine
toinetoine / NoKoogra.cs
Created Jun 10, 2016
Reading .NET worksheets without Koogra
View NoKoogra.cs
Microsoft.Office.Interop.Excel._Application _app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook workbook = _app.Workbooks.Open(filePath);
Microsoft.Office.Interop.Excel.Worksheet sheet = workbook.Sheets[sheetName] as Microsoft.Office.Interop.Excel.Worksheet;
Microsoft.Office.Interop.Excel.Range range = sheet.get_Range("A1:A1", System.Reflection.Missing.Value);
return range.Text;
View 1455438.json
{
"number": 1455438,
"hash": "0x0ff4e11dd10713f86d80c71a3d3566c52b0e40f1eaa822f8c9de5df2a79b50a3",
"parentHash": "0xc5ea14302610f08f0e8143eff0e05ea1d5ad36b3f424bdef6edbf3029d4d9970",
"nonce": "0xf31e0378078fbb29",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0xca67929764679c0f8555a741da5845cfd079dc8978c8d53711289848a9fe85fd",
"stateRoot": "0xef998cece82ee472c447ba7ab3c8c31705612fa06f65e5c628ef44033
View gist:a63b61ed45395e4e716e
var a = new Date ( 0 );
a.setMilliseconds(1457991774772);
var b = new Date(1457991774772); 
// would think their the same but b is one hour after a...
View datastructs.h
#define LED_COUNT (11)
#define LED(n) (1 << (n))
#define ALL_LEDS(LED(LED_COUNT)-1)
struct frame {
unsigned short *data;
unsigned int resolution;
};
View packed.c
#include "datastructs.h"
#define nitems(x) (sizeof(x) / sizeof((x)[0]))
static unsigned short spiral_data[LED_COUNT] = {
LED(0), LED(1), LED(2), LED(3),
LED(4), LED(5), LED(6), LED(7),
LED(8), LED(9), LED(10)
};
struct frame spiral {
You can’t perform that action at this time.