Skip to content

Instantly share code, notes, and snippets.

View vilicvane's full-sized avatar
🌏

vilicvane vilicvane

🌏
View GitHub Profile
@vilicvane
vilicvane / .active-mouse-server.config.mjs
Created January 25, 2024 18:00
Active Mouse Monitor Input Select Script
import {spawn} from 'child_process';
const CONTROL_MY_MONITOR_PATH =
'C:\\Utilities\\controlmymonitor\\ControlMyMonitor.exe';
const MONITORS = ['JPKRZG3', '6ZWV123'];
const MONITOR_INPUTS_DICT = {
'vane-station': [15, 15],
'vane-mbp': [27, 27],
@vilicvane
vilicvane / snake.html
Last active January 26, 2023 18:04
Snake game written with T9 keyboard using Nokia 6120c in 2009
<body></body>
<script>
try{
var w=20, h=20;
var s=10;
var t=2500;
var sl=5;
var lx=1, ly=0;
var ax=1, ay=0;
@vilicvane
vilicvane / script.ts
Created March 15, 2022 05:21
盯梢:GitHub中文项目趋势
import Cheerio from 'cheerio';
const PROJECT_DEDUPLICATE_LIMIT = 10000;
const WEEKLY_STARS_THRESHOLD = 100;
type Context = ScriptContext<{
projects: string[];
}>;
export default async function (_payload: {}, {storage}: Context): Promise<ScriptMessage | undefined> {
@vilicvane
vilicvane / wsl-host.ps1
Last active December 3, 2022 06:25
Access Windows host from WSL 2
# Access host ports from WSL 2.
# https://gist.github.com/vilic/0edcb3bec10339a3b633bc9305faa8b5
# Make sure WSL gets initialized.
bash.exe -c exit
# Record host name for /etc/hosts that points to host IP.
$HOST_NAME = "host.wsl";
# Ports listened on host localhost to forward, you don't need to add the port if it listens all addresses.
import {Agent as HttpsAgent} from 'https';
import Debug = require('debug');
import _ = require('lodash');
import {inflate} from 'pako';
import * as ProxyAgent from 'proxy-agent';
import {Subject} from 'rxjs';
import WebSocket = require('ws');
const US_API_URL = 'wss://api.huobipro.com/ws';
# Save this file as $PROFILE (run `echo $PROFILE` in powershell)
Set-Alias gh Get-Help;
Set-Alias cd Push-Location -Option AllScope;
Set-Alias cdb Pop-Location -Option AllScope;
Set-PSReadLineOption -HistoryNoDuplicates;
# For `cdp` (cd project)
$ProjectDirectory = 'C:\Projects';
@vilicvane
vilicvane / track-by.directive.ts
Created September 27, 2017 09:48
Angular: "track by" structural directive for single component/element
import {
Directive,
EmbeddedViewRef,
Input,
OnInit,
TemplateRef,
ViewContainerRef,
} from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@vilicvane
vilicvane / prism.css
Created August 14, 2017 16:14
prism.js for blog
/* http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clike+javascript+aspnet+c+csharp+cpp+css-extras+handlebars+java+json+less+typescript */
/**
* prism.js Twilight theme
* Based (more or less) on the Twilight theme originally of Textmate fame.
* @author Remy Bach
*/
code[class*="language-"],
pre[class*="language-"] {
color: white;
background: none;
@vilicvane
vilicvane / settings.json
Last active April 16, 2016 05:26
VS Code settings
{
"window.zoomLevel": -0.5,
"editor.insertSpaces": true,
"editor.folding": false,
"files.autoSave": "afterDelay",
"files.trimTrailingWhitespace": true,
"files.eol": "\n",