Skip to content

Instantly share code, notes, and snippets.

@mwrouse
mwrouse / Autocomplete.js
Last active December 14, 2024 19:53
Autocompletion for an object in the monaco editor
function ShowAutocompletion(obj) {
// Disable default autocompletion for javascript
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true });
// Helper function to return the monaco completion item type of a thing
function getType(thing, isMember) {
isMember = (isMember == undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false
switch ((typeof thing).toLowerCase()) {
case "object":
@ncalm
ncalm / excel-lambda-RANK.DENSE.txt
Last active December 14, 2024 19:50
This Excel lambda function provides a ranking mechanism similar to SQL's DENSE_RANK, but follows the pattern of RANK.AVG and RANK.EQ
/*
RANK.DENSE
Ranks a one-dimensional array using the provided sort order. If adjacent items have the same value, they are all given the rank of the first of them.
Ranks following equally ranked groups increment by one from the most recent rank. This is as opposed to RANK.EQ where following ranks are given the rank
they would have received if the same-ranked items were given different ranks. As such, this function behaves similarly to SQL's DENSE_RANK
Inputs:
Number - A number or array of numbers to find the rank for from the ranks given by Ref sorted by Order
Ref - A list of numbers to be ranked, from which the rank of Number will be found
@mattmc3
mattmc3 / optparsing_demo.zsh
Last active December 14, 2024 19:50
Zsh option parsing example
# Manual opt parsing example
#
# Features:
# - supports short and long flags (ie: -v|--verbose)
# - supports short and long key/value options (ie: -f <file> | --filename <file>)
# - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>)
# - does NOT support short option chaining (ie: -vh)
# - everything after -- is positional even if it looks like an option (ie: -f)
# - once we hit an arg that isn't an option flag, everything after that is considered positional
function optparsing_demo() {
@genyrosk
genyrosk / REISUB.md
Created November 3, 2022 18:52
REISUB: A gentle Linux restart

REISUB

If a Linux machine locks up or freezes completely, use REISUB to restart it more gently than pushing the Power Button.

Hold down Alt and the SysReq (Print Screen) keys, and then type R E I S U B, with 2-3 second delays between the key presses to give the commands a better chance to complete.

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
@Verssae
Verssae / safetyedu.js
Last active December 14, 2024 19:45
한양대 안전교육 스킵 스크립트
/*
Hanyang Univ. a script for skipping safetyedu courses
http://safetyedu.hanyang.ac.kr/
[교육 영상 스킵]
1. '수강하기' 버튼을 눌러 안전교육 창을 띄운다.
2. 개발자도구(F12 버튼을 눌러) 열어 'console' 탭에 이동해 아래 스크립트를 붙여넣는다.
3. 6과목에 대해 반복한다.
@mcmah309
mcmah309 / context.txt
Created December 14, 2024 19:32 — forked from zackangelo/context.txt
Llama 3.3 Multi-tool Use Context Window
<|begin_of_text|><|start_header_id|>system<|end_header_id|>Environment: ipython
Cutting Knowledge Date: December 2023
Today Date: 13 Dec 2024
# Tool Instructions
You may optionally call functions that you have been given access to. You DO NOT have
to call a function if you do not require it. ONLY call functions if you need them. Do NOT call
functions that you have not been given access to.
import asyncio
import base64
import json
import os
import pyaudio
from websockets.asyncio.client import connect
class SimpleGeminiVoice:
def __init__(self):
@khronokernel
khronokernel / electron_patcher.py
Last active December 14, 2024 19:25
Electron and Chrome patcher to force OpenGL rendering
"""
electron_patcher.py: Enforce 'use-angle@1' in Chrome and Electron applications
Version 1.0.0 (2024-08-11)
"""
import enum
import json
from pathlib import Path
@cyruscyliu
cyruscyliu / install-python38-ubuntu1604.sh
Last active December 14, 2024 19:23
Install python3.8 on Ubuntu 16.04
sudo apt-get update
sudo apt-get install -y build-essential \
zlib1g-dev libncurses5-dev libgdbm-dev \
libnss3-dev libssl-dev libreadline-dev \
libffi-dev libsqlite3-dev wget libbz2-dev
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -xf Python-3.8.0.tgz
cd Python-3.8.0
./configure --enable-optimizations
make -j 8