Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View allenyllee's full-sized avatar

Allen.YL allenyllee

View GitHub Profile
@allenyllee
allenyllee / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# GDC Vault videos can't be watched on mobile devices and this is a very sad thing indeed!
# (Note: this has changed for GDC2013, which lets you watch raw MP4 streams. Kudos!)
# This script is designed to circumvent this by downloading the lecture and slideshow
# videos which can then be re-encoded into whatever format you wish. Obviously, you
# won't be able to do this without access to the Vault. This is strictly for the
# convenience of legitimate Vault users!
# Note: this code is rather flimsy and was written as fast as possible for my own personal use.
# The code only works for the most recent GDC Vault videos, since they all use the same player
# format. If the XML format used to run the player is changed (as it has in the past), the code
@allenyllee
allenyllee / Sign.bat
Last active July 13, 2016 02:04
#There are some useful batch files.
@ECHO OFF
:sku_selection
Set PROJECT=
ECHO Which PROJECT do you want to sign?
ECHO 1. D17
ECHO 2. D15
ECHO 3. E15
Set /p PROJECT=Please type the number:
@allenyllee
allenyllee / SB_ACPIDelay.c
Last active July 13, 2016 02:45
There are some UEFI BIOS code snippet
#include <PegaCommonHeaders.h>
#define ACPI_TIMER_ADDRESS (PM_BASE_ADDR+0x08)
#define BITS_IN_ACPI_TIMER 24 // The current bits in ACPI Timer - Porting need
VOID SB_ACPIDelay(UINTN MicroSeconds)
{
UINTN TicksNeeded;
UINT32 TimerValue, NewTimerValue;
UINTN OverFlow;
@allenyllee
allenyllee / _Useful_Shell_Script.md
Last active July 13, 2016 02:46
There are some useful Shell Script.

#There are some useful Shell Script.

@allenyllee
allenyllee / Probability.c
Last active July 13, 2016 02:54
There are some simple C function
/**
問題:假設記憶遊戲使用12張牌,6對(112233445566)
    規則為每次翻兩張,相同就保留,不同就蓋回背面
    給六次機會,請問用程式算翻出6對~1對的機率為何?
**/
/**
不記牌的抽中機率
@allenyllee
allenyllee / public.py
Created August 24, 2017 14:09 — forked from dooglus/public.py
create Bitcoin public key from private key
#! /usr/bin/env python
class Point(object):
def __init__(self, _x, _y, _order = None): self.x, self.y, self.order = _x, _y, _order
def calc(self, top, bottom, other_x):
l = (top * inverse_mod(bottom)) % p
x3 = (l * l - self.x - other_x) % p
return Point(x3, (l * (self.x - x3) - self.y) % p)
@allenyllee
allenyllee / example.cu
Created September 22, 2017 11:19 — forked from dpiponi/example.cu
Minimal CUDA example (with helpful comments).
#include <stdio.h>
//
// Nearly minimal CUDA example.
// Compile with:
//
// nvcc -o example example.cu
//
#define N 1000