Skip to content

Instantly share code, notes, and snippets.

View myfreeer's full-sized avatar
💭
I may be slow to respond.

myfreeer

💭
I may be slow to respond.
View GitHub Profile
// ==UserScript==
// @name Youku Fix Cna
// @namespace myfreeer
// @version 0.1
// @description 为Youku提供cna cookie
// @author myfreeer
// @match http://v.youku.com/*
// @match https://v.youku.com/*
// @license MIT
// @run-at document-start
/**
* Class AsyncThread: Async-based threading
* @license BSD-3-Clause
*/
class AsyncThread extends Array {
/**
* @typedef {Object} task
* @property {*} data - [optional] argument of `resolver`
* @property {Function} resolver - a function that takes `data` as the only argument, returns Promise
*/
#include <windows.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc < 2) return 1;
char *ptr;
unsigned long time = strtoul(argv[1], &ptr, 10);
if (ptr[0] != argv[1][0]) {
Sleep(time);
return 0;
#define UNICODE
#define _UNICODE
#include <windows.h>
//main entry
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
const int cmdLineLength = lstrlenW(lpCmdLine);
if (cmdLineLength == 0) {
return 1;
}
for (int i = 0; i < cmdLineLength; i++) {
#include <windows.h>
wchar_t *getCurrentDirW(void)
{
static wchar_t buffer[MAX_PATH];
GetCurrentDirectoryW(MAX_PATH, buffer);
return buffer;
}
char *getCurrentDirA(void)
@myfreeer
myfreeer / ontop-playback.lua
Last active May 27, 2017 05:54
mpv userscript to make mpv play videos on top when playing and playback window height larger then screen height (needed to be specified in script)
-- mpv userscript to make mpv play videos on top when playing and playback window height larger then screen height
local was_ontop = true
-- specify screen height here
local screen_height = 768
function playbackEventListener(name, value)
local ontop = mp.get_property_native("ontop")
local dheight = mp.get_property_native("dheight",0)*mp.get_property_native("window-scale",0)
/* xargs - Make and execute commands Author: Ian Nicholls: 1 Mar 90 */
/*
* xargs - Accept words from stdin until, combined with the arguments
* given on the command line, just fit into the command line limit.
* Then, execute the result.
* e.g. ls | xargs compress
* find . -name '*.s' -print | xargs ar qv libc.a
*
* flags: not any
let crctable = function() {
let c = 0,
table = typeof Int32Array !== 'undefined' ? new Int32Array(256) : new Array(256);
for (let n = 0; n !== 256; ++n) {
c = n;
for (let x = 0; x < 8; x++) {
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
}
table[n] = c;
}
@myfreeer
myfreeer / appveyor.yml
Last active May 29, 2017 05:41
Tiny C Compiler build scripts on msys2
version: 1.0.{build}
build_script:
- cmd: >-
C:\msys64\usr\bin\pacman -Syyuu --noconfirm
C:\msys64\usr\bin\pacman -Suu --noconfirm
appveyor DownloadFile https://gist.github.com/myfreeer/c8df0b2acbf97e8b391ca741e5248f3f/raw/tinycc-build.sh
set MSYSTEM=MINGW64
@myfreeer
myfreeer / cycle-denoise.lua
Last active January 19, 2025 09:23
mpv user-script to cycle between lavfi's denoise filters, tested over mpv 0.25.0-58-g99cef59fc
-- settings
-- key_binding: press the key specified below
-- to cycle between denoise filters below,
-- set it to nil to disable the binding
local key_binding = "n"
-- key_binding_reverse cycle between denoise filters below
-- in reverse order, set it to nil to disable the binding,
-- set it to a single-char string to enable
local key_binding_reverse = nil