This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A simple way to store binary data inside a js/ts file with a density of 1 char per byte. | |
// Even though each char takes 2 bytes. | |
const b256enc = (buff: Uint8Array) => [...buff].map(i => String.fromCodePoint(i + 192)).join(''); | |
const b256dec = (str: string) => str.split('').map(c => c.charCodeAt(0) - 192); | |
// Example 1: Basic usage | |
const data = new Uint8Array([ 127, 127, 168, 226, 120, 62, 44, 146, 82, 213, 0, 30 ]); | |
const encoded = b256enc(data); | |
console.log(encoded); // 'ĿĿŨƢĸþìŒĒƕÀÞ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
#include <string> | |
enum mode {unknown, open, playing, paused, stopped }; | |
class MCI | |
{ | |
// davidxl.blogspot.com | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function packUUID(uuid: string): string { | |
let v; | |
let bytes = ''; | |
// Parse ########-....-....-....-............ | |
bytes += String.fromCharCode((v = parseInt(uuid.slice(0, 8), 16)) >>> 24); | |
bytes += String.fromCharCode((v >>> 16) & 0xff); | |
bytes += String.fromCharCode((v >>> 8) & 0xff); | |
bytes += String.fromCharCode(v & 0xff); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="loader"></div> | |
<style> | |
.loader { | |
--size: 5rem; | |
--weight: .5rem; | |
--background: rgba(127, 127, 127, .1); | |
--color: rgba(127, 127, 127, .9); | |
--duration: 1s; | |
position: fixed; | |
top: calc(50% - var(--size) / 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <Shlwapi.h> | |
#include <stdio.h> | |
#pragma comment(lib, "shlwapi.lib") | |
char* assocStr[] = | |
{ | |
"ASSOCSTR_COMMAND", | |
"ASSOCSTR_EXECUTABLE", | |
"ASSOCSTR_FRIENDLYDOCNAME", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Unsubscribe from all "orgName" repositories in https://github.com/watching | |
* | |
* https://github.com/isaacs/github/issues/641 | |
* @param string orgName | |
*/ | |
function unwatchOrgRepos(orgName) { | |
if (!window.location.href.startsWith('https://github.com/watching')) { | |
throw new Error('This script is intended to be run in "https://github.com/watching"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Locale strings | |
* You can get it from https://github.com/iamkun/dayjs/blob/dev/src/locale/ | |
*/ | |
const loc = { | |
future: 'in %s', | |
past: '%s ago', | |
s: 'a few seconds', | |
m: 'a minute', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <string.h> | |
#include <wchar.h> | |
static char* utf16_to_utf8 (const wchar_t *src) | |
{ | |
size_t len = wcslen(src), si, di; | |
char *dst = (char*)malloc(sizeof(*dst)*(3*len+1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Pavan Kumar Sunkara | |
email = pavan.sss1991@gmail.com | |
username = pksunkara | |
[core] | |
editor = vim | |
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
excludesfile = ~/.gitignore | |
[sendemail] | |
smtpencryption = tls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your ~/.gitconfig or ~/.config/git/config | |
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName> | |
[user] | |
name = Your Full Name | |
email = your@email.tld | |
[color] | |
# Enable colors in color-supporting terminals | |
ui = auto | |
[alias] | |
# List available aliases |
NewerOlder