Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
oxidizing

Mingwei Samuel MingweiSamuel

🦀
oxidizing
View GitHub Profile
View challenges.json
[
"12AssistStreakCount",
"abilityUses",
"acesBefore15Minutes",
"alliedJungleMonsterKills",
"baronBuffGoldAdvantageOverThreshold",
"baronTakedowns",
"blastConeOppositeOpponentCount",
"bountyGold",
"buffsStolen",
View arr.rs
macro_rules! arr {
(
$( #[$attr:meta] )*
$v:vis $id:ident $name:ident: [$ty:ty; _] = $value:expr
) => {
$( #[$attr] )*
$v $id $name: [$ty; $value.len()] = $value;
}
}
View ucb_seal.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MingweiSamuel
MingweiSamuel / README.md
Created Dec 8, 2019
Text-to-Speech for League of Legends streaming
View README.md

Run this powershell script. In-game, you can type /n . This writes a note to MyNotes.txt, which is read by the script and spoken outloud. Useful for streaming without a mic or talking to yourself when you're lonely.

@MingweiSamuel
MingweiSamuel / semaphore.js
Last active Dec 6, 2019
Tiny Javascript Semaphore
View semaphore.js
function Semaphore(count) {
this.permits = count;
this.queue = [];
}
Semaphore.prototype.acquire = function() {
return new Promise(resolve => {
if (0 === this.permits)
this.queue.push(resolve);
else {
View hacky google apps script invert colors script .js
function onOpen() {
const ui = DocumentApp.getUi();
// Or DocumentApp or FormApp.
ui.createAddonMenu()
.addItem('Invert Selected', 'doInvertSelected')
.addToUi();
}
function invertColor(val) {
return '#' + ('00000' + (0xFFFFFF - parseInt(val.substr(1), 16)).toString(16)).substr(-6);
View adventofcode.js
// DAY 3
(function(rows) {
let claims = Array.from(Array(1000).keys()).map(() => Array(1000).fill(0));
for (let row of rows) {
let [ , , loc, size ] = row;
loc = loc.split(',').map(Number);
size = size.split('x').map(Number);
for (let i = 0; i < size[0]; i++) {
let claimRow = claims[loc[0] + i];
for (let j = 0; j < size[1]; j++) {
View testswap.py
from azure.common.exceptions import CloudError
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
SSH_USERNAME = 'ubuntu'
View random_50_75.txt
50
Itoshima Tokushima Tamana Joetsu Higashiyamato Tsubame Shisou Shimabara Hanno Wakayama Sango Kashihara Kani Sumoto Maibara Asahikawa Kasaoka Komae Kitakami Odo Sanuki Kitahiroshima Tagawa Miyakonojo Kiryu Fujisawa Gotenba Zama Naka Tsuruoka Hiroshima Koshigaya Narita Kyoto Morui Tokorozawa Akita Miyama Annaka Matsuura Tagajo Fujiyoshida Kadoma Kurume Yawata Abiko Kobayashi Seiyo Fukuroi Satsumasendai
169.80381765787627 662.5432691383742 x x x 536.0733799309679 268.74063261977864 x x x x x 655.3609599975988 x 186.03350816135605 x x x 720.5420452360715 x 191.74336022679694 146.47419127719863 x x 396.6497899938318 417.3048090136152 x 223.92533606928922 862.6583032692702 683.5657590614952 x x 767.7234916126935 x 116.10788282009865 947.9276455536063 38.75192912277514 38.76354433712656 x x 989.7381973884163 200.06147840542468 505.50317204811887 x 586.0996505310661 27.690748018022358 x x x x
662.5432691383742 93.50239786834088 26.36887333545462 409.8430510675028 40.456863850201984 568.9825549044463 481.8842142241
View roadtripBroken.js
function test() {
for (let i = 0; i < 20; i++) {
let problem = generateProblem();
console.log('Problem:', problem);
let ansFast = roadTripFast(...problem);
let ansKey = roadTripKey(...problem);
console.log(ansFast, ansKey);
if (ansFast === ansKey)
console.log('%cPASS', 'color: #0A0');
else