Skip to content

Instantly share code, notes, and snippets.

View Gravifer's full-sized avatar

Tci Gravifer Fang Gravifer

View GitHub Profile
@Gravifer
Gravifer / BucketStack.py
Created November 26, 2024 09:35
Bucket stack value
# https://chatgpt.com/share/674595bf-959c-8007-ab19-7a9d55328526
class BucketStack:
def __init__(self):
self.stack = []
def push(self, bucket):
self.stack.append(bucket)
def pop(self):
if self.stack:
@Gravifer
Gravifer / windowsTerminal_themeToggler.ps1
Last active October 10, 2022 09:17
Windows Terminal theme mode toggler script
# see https://github.com/microsoft/terminal/issues/4066#issuecomment-991775872
# Feature deprecated
# # A Light colorScheme is bound as counterpart to one and only one Dark colorScheme.
# # To configure two colorSchemes as a pair, select one of them as default in dark mode,
# # switch to light mode, select the other as default, then switch back to dark mode;
# # the script will now toggle this pair correctly for any other profile.
param(
[String] $themeMode, # if not provided, default to the opposite of the mode recorded in the config file
@Gravifer
Gravifer / Get-GeoCodeCoordinatesAddress.ps1
Last active June 20, 2021 13:16
PowerShell script to display local weather report
$dependencies = @(
"Get-GeoLocationCoordinates",
)
foreach ($script in ){
iex ((New-Object System.Net.WebClient).DownloadString("https://gist.githubusercontent.com/Gravifer/a0012ea5f115bf48bc652c1b02845bd8/raw/d6d06a82ed8282e14aed0f258ff39b8e89dcf01e/$script.ps1"))
}
function Get-GeoCodeCoordinatesAddress {
param (
[Parameter(ValueFromPipeline=$true)]
@Gravifer
Gravifer / MMA_1lners.md
Last active March 18, 2021 14:43
Mathematica one-liners

Mathematica one-liners

  • Visualize a block matrix mat
    MatrixForm[{Grid[Map[Grid, mat, {2}], Dividers -> Center]}]

performance notes

  • In prototyping, you may use something like
@Gravifer
Gravifer / bucketlist.md
Created February 24, 2021 06:55
My BucketList

My BucketList

  • This list is still far from complete.

  • Coq

  • Lean (prover)

  • Haskell

  • OCaml

@Gravifer
Gravifer / WakaTime.wl
Last active February 24, 2021 17:37
WakaTime API for Mathematica
(* ::Package:: *)
(* ::Title:: *)
(*Mathematica WakaTime Plugin*)
(* ::Author:: *)
(*Author: Gravifer*)
(*Date: 2021-02-21*)
(*Version: 0.0.3*)
@Gravifer
Gravifer / wolfram_paclet_context_install.md
Last active February 16, 2021 09:58
Install Wolfram paclets from the Windows context menu

A little tweaking to install wolfram paclets in the Windows explorer. It is always possible to modify the registry manually; but for a less painstaking way, you can use FileTypesMan by Nir Sofer and Resource Hacker by Angus Johnson.

Paclets are merely .zip archives with concerned .m package files and some versioning code. It's convenient to add unzipping and installing actions to the right-click context menu. For installation:

wolframscript.exe -code "pac=Last[$ScriptCommandLine]; Print[StringJoin[\"Trying to install \", pac, \" ...\"]]; PacletInstall[pac]" "%1"
@Gravifer
Gravifer / bs.md
Last active August 28, 2020 01:34
Personal git-GitHub troubleshooting recipes (for rookies like me)

Personal git-GitHub troubleshooting recipes

Push to GitHub failed by phantom large files

This occurs when I have made mistaken commits and then tried to push in a latter commit when those large files no more exist; in this case merely clean up the cache doesn't work and requires more labor. I found a better approach at this post from StackOverflow
So the remedy is

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD

And you should be good to go.