Skip to content

Instantly share code, notes, and snippets.

View allenyllee's full-sized avatar

Allen.YL allenyllee

View GitHub Profile
@allenyllee
allenyllee / FindOpenMP.cmake
Created September 30, 2017 15:55 — forked from mirkow/FindOpenMP.cmake
Modified FindOpenMP to work with Clang 3.8 under Ubuntu 14.04
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindOpenMP
# ----------
#
# Finds OpenMP support
#
# This module can be used to detect OpenMP support in a compiler. If
@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
@allenyllee
allenyllee / ppt2pdf.ps1
Last active December 15, 2021 07:24 — forked from mp4096/ppt2pdf.ps1
Batch convert PowerPoint files to PDF with pen markups
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
##
## about_Execution_Policies | Microsoft Docs
## https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1&viewFallbackFrom=powershell-Microsoft.PowerShell.Core
## Beginning in Windows PowerShell 3.0, you can use the Stream parameter of the Get-Item cmdlet to detect files that are blocked because they were downloaded from the Internet, and you can use the Unblock-File cmdlet to unblock the scripts so that you can run them in Windows PowerShell.
@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)
// import_json_appsscript.js
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
//
// Changelog:
// (Oct. 16 2019) tag: allenyllee-20191016
// 1. Fixed google script error: urlfetchapp - service invoked too many times https://stackoverflow.com/questions/10598179/google-apps-script-urlfetchapp-service-invoked-too-many-times
// (Jul. 16 2018) tag: allenyllee-20180716
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member."
// (Nov. 30 2017) tag: allenyllee-20171130
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index
@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 / 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:

Linux Driver Coding Notes

##I/O Device Driver

  • Character Driver
  • Block Driver