Skip to content

Instantly share code, notes, and snippets.

View hiepxanh's full-sized avatar

hiepxanh hiepxanh

View GitHub Profile
@hiepxanh
hiepxanh / add-voice.ps
Created November 23, 2017 03:08
Add microsoft core voice to any application can use
$sourcePath = 'HKLM:\software\Microsoft\Speech_OneCore\Voices\Tokens' #Where the OneCore voices live
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens' #For 64-bit apps
$destinationPath2 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens' #For 32-bit apps
cd $destinationPath
$listVoices = Get-ChildItem $sourcePath
foreach($voice in $listVoices)
{
$source = $voice.PSPath #Get the path of this voices key
copy -Path $source -Destination $destinationPath -Recurse
copy -Path $source -Destination $destinationPath2 -Recurse
@hiepxanh
hiepxanh / .txt
Created March 20, 2024 14:14
Q* Leaked info:
https://pastebin.com/RkBUQPLb
Q* is a dialog system conceptualized by OpenAI, designed to enhance the traditional dialog generation approach through the implementation of an energy-based model (EBM). Distinct from the prevalent autoregressive token prediction methods, Q* aims to mimic a form of internal deliberation akin to human thought processes during complex problem-solving, such as chess playing, where a deeper analysis of potential moves leads to better decision-making compared to rapid, less considered responses. This model shifts focus towards the inference of latent variables, reminiscent of constructs in probabilistic models and graphical models, fundamentally altering how dialog systems operate.
Energy-Based Model for Dialog Generation
At the core of Q* is the EBM, which operates by assessing the compatibility of an answer to a given prompt through a scalar output. This output signifies the "energy" of the response, where a lower value indicates a high compatibility (a better answer) and a highe
@hiepxanh
hiepxanh / Claude 3 prompt .md
Last active March 9, 2024 04:22
Claude 3 prompt

source: https://twitter.com/mattshumer_/status/1766157714411942055?s=49

Here is probably the most useful Claude 3 prompt I've written.

Use it to you help make engineering decisions in unfamiliar territory:

---
<role>You are an engineering wizard, experienced at solving complex problems across various disciplines. Your knowledge is both wide and deep. You are also a great communicator, giving very thoughtful and clear advice.</role>

You provide advice in the following <response_format>:
@hiepxanh
hiepxanh / gist:73fc9a242661e448d7fa44a06845405d
Last active November 29, 2023 08:45
lazy load file prism
// // this.loadFile('prism.css', 'prism-style');
// // this.loadFile('prism.js', 'prism-script', 'script');
// // https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+c+csharp+cpp+graphql+java+kotlin+markup-templating+php+python+ruby+scss+sql+swift+typescript+yaml&plugins=toolbar+copy-to-clipboard
loadFile(fileName: string, idName: string, mode: 'link' | 'script' = 'link') {
// for angular.json => if style go styles: [];, if script go scripts: []
// {
// "input": "node_modules/quill/dist/quill.core.css",
// "inject": false,
// "bundleName": "quill.core"
@hiepxanh
hiepxanh / index.html
Created April 29, 2023 02:54
angular vite
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
</head>
<body>
<div id="app"></div>
@hiepxanh
hiepxanh / THREE Image Transition.markdown
Created April 22, 2018 05:40
THREE Image Transition
@hiepxanh
hiepxanh / gist:9bb1d4845e48826c55c69bd52d75ad6f
Created October 27, 2022 02:26
nestjs-custom-cache.interceptor.ts
import {
Injectable,
NestInterceptor,
ExecutionContext,
CallHandler,
} from "@nestjs/common";
import { CACHE_MANAGER, Inject } from "@nestjs/common";
import { Cache } from "cache-manager";
import {
from,
@hiepxanh
hiepxanh / datepicker-lazy.ts
Created May 23, 2022 10:26
angular 14 standalone lazyload angular material datepicker
@ViewChild('datepickerTemplate', { read: ViewContainerRef }) datepickerTemplate!: ViewContainerRef;
constructor(private fb: FormBuilder) {}
async loadComponent() {
const { DatepickerAtom } = await import('../../atoms/datepicker/datepicker.atom');
const componentRef = this.datepickerTemplate.createComponent(DatepickerAtom);
const dobControl = this.optionalForm.get('dob');
if (dobControl) {
componentRef.instance.dob = dobControl;
}
@hiepxanh
hiepxanh / .ts
Created March 7, 2022 02:04
typescript groupBy and more support function on object for javascript
declare global {
interface Array<T> {
groupBy(keyField: string): object;
arrayToObject(keyField: string): object;
unique(id: string): T[];
addMoreItemProperty(idKey: string, idValue: string | number, updateData: any): T[];
mergeArrayByProperty(idKey: string, otherArray: T[]): T[];
sortByKey(order?: 'asc' | 'desc', keyName?: string): T[];
}
# https://github.com/SocialEngine/docker-nginx-spa
# http://www.cicoria.com/forcing-tls-https-on-azure-web-apps-for-linux/
# https://github.com/GaryB432/angular-pwa/blob/master/nginx.conf
charset utf-8;
tcp_nopush on;
tcp_nodelay off;
client_header_timeout 10s;