Skip to content

Instantly share code, notes, and snippets.

View favoyang's full-sized avatar

Favo Yang favoyang

View GitHub Profile
set remindersOpen to application "Reminders" is running
set todoistToken to "<YOUR_TOKEN_HERE>"
set apiCall to "curl https://api.todoist.com/sync/v9/quick/add"
set listOfCommands to {}
tell application "Reminders"
@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active May 1, 2024 15:04
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@marcospgp
marcospgp / SafeTask.cs
Last active May 6, 2024 10:34
Cancel async tasks in Unity upon exiting play mode
using System;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
namespace UnityUtilities
{
/// <summary>
/// A replacement for `Task.Run()` that cancels tasks when entering or
/// exiting play mode in the Unity editor (which doesn't happen by default).
# [CONFIGURATION]
# Ensure WSL2 container is started and SSH is running
wsl sudo /etc/init.d/ssh start
# Ports to be forwarded
$ports = @(22) + @(6543,6544) + @(6800..6810);
# Change $addr to restrict connections to a particular interface IP
$listen_addr = '0.0.0.0';
@Frenchcooc
Frenchcooc / Sparkline.vue
Last active May 31, 2023 16:29
Simple sparkline component for Vue.js
<template>
<svg class="sparkline" :width="width" :height="height" :stroke-width="stroke">
<path class="sparkline--line" :d="shape" fill="none"></path>
<path
class="sparkline--fill"
:d="[shape, fillEndPath].join(' ')"
stroke="none"
></path>
</svg>
</template>
@mikerochip
mikerochip / MikesAddressablesTrainingManual.md
Last active May 23, 2021 17:16
Mike's Addressables Training Manual
@mob-sakai
mob-sakai / _README.md
Last active February 20, 2024 00:29
Run shell script on gist

Run shell script on gist

Shells that support process substitution such as bash and zsh allow to run shell script on gist as follows.

# With curl:
bash <(curl -sL ${GIST_URL}) args...

# With wget:
@BatteryAcid
BatteryAcid / lambdaClientService.js
Last active October 26, 2021 14:28
Unity + Amazon GameLift setup in web console Part 2 snippets
// Example Lambda Client Service for Realtime Server example
// Original source: https://aws.amazon.com/blogs/gametech/creating-servers-for-multiplayer-mobile-games-with-amazon-gamelift/
// Contains @BatteryAcid's edits to accompany video Unity + Amazon GameLift setup in web console
// https://youtu.be/WaAZyqgkXDY
//const uuid = require('uuid');
const {"v4": uuidv4} = require('uuid');
const AWS = require('aws-sdk');
const GameLift = new AWS.GameLift({region: 'us-east-1'});
@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.
@MichaelCurrin
MichaelCurrin / README.md
Last active March 5, 2024 22:06
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query