Skip to content

Instantly share code, notes, and snippets.

16f5c6b1eab75b42ae7262d38ce4b1b214762475cf5d1d6a1adf288334fc264c
@user202729
user202729 / README.md
Last active August 22, 2021 13:13
Use JavaScript interactive/REPL shell with vim (like IPython + jupyter-vim)

Update: there might be a better way. Lookup "vim Node.js REPL" ("interactive shell" doesn't result in anything. The terminology is different between Python and Node.js/JavaScript)


These kernels [2] doesn't work

@user202729
user202729 / Password-generate.html
Last active February 4, 2022 16:32
Good diceware/memorable password generation program based on part-of-speech?
<script>
"use strict";
const data={
ADJECTIVE:["Able","Absent","Absolute","Abstract","Absurd","Academic","Acceptable","Accessible","Accountable","Accurate","Acid","Active","Actual","Acute","Additional","Adequate","Adjacent","Administrative","Adult","Advance","Advanced","Adverse","Aesthetic","Affordable","Afraid","Aged","Agricultural","Alert","Alien","Alike","Alive","Alone","Alternative","Amateur","Amazed","Amazing","Ambitious","Amusing","Ancient","Angry","Annoyed","Annoying","Annual","Anonymous","Anxious","Apparent","Appealing","Applicable","Appropriate","Arbitrary","Architectural","Artificial","Artistic","Ashamed","Asleep","Assistant","Associated","Astonishing","Attractive","Audio","Authentic","Automatic","Available","Average","Aware","Awful","Awkward","Back","Bad","Balanced","Bare","Based","Basic","Beautiful","Beloved","Beneficial","Bent","Best","Better","Big","Biological","Bitter","Bizarre","Blank","Blind","Blonde","Blue","Bold","Bored","Boring","Bottom","Bound","Brave","Brief","Bright","Brilliant","Broad
@user202729
user202729 / anydesk-shortcut.py
Created September 26, 2021 14:56
Keyboard shortcut for controlling Anydesk on X/Linux (use some other program to bind the shortcut to executing the script)
#!/bin/python
"""
Usage: run
<program> 70: toggle "control mouse and keyboard"
<program> 130: toggle "block user's input"
Only works on X.
Requires xprop and xdotool.
@user202729
user202729 / Unicode-ANSI-string-VBA.md
Created October 5, 2021 12:43
Introduction to Unicode and ANSI string types in VBA

In VBA, there are two types of string: Unicode string and ANSI string.

Definition

Unicode string

Unicode string (type String) contains a sequence of UTF-16 code points, and can represent any Unicode characters.

Characters not in the BMP (Basic Multilingual Plane) is represented by a pair of surrogate.

@user202729
user202729 / PowerPoint-convert-to-new-file-format.vba
Created October 12, 2021 06:35
VBA macro to convert old PowerPoint .ppt file format to new .pptx format, without compatibility mode, and embed the multimedia files.
' Main function: ActiveToNewFormat, convert the file to new format
' Reference: (TODO add reference)
' License: GNU GPL v3 or later
Function GetNoSuffix() As String
Dim name As String
name = ActivePresentation.FullName ' a/b.c
pos = InStrRev(name, ".")
@user202729
user202729 / Word-bottom-border-consistent.vba
Created October 12, 2021 06:53
Make page length more uniform/improve the bottom line in Word
' License: GNU GPL v3 or later
' Related: https://web.archive.org/web/20210329112712/http://wordfaqs.ssbarnhill.com/BottomLine.htm
' Usage: function names should be easy to understand. The functions/subs that take parameters are internal helper functions.
' Reference: TODO add reference
Private Declare PtrSafe Function MessageBoxW Lib "User32" (ByVal hWnd As LongPtr, ByVal lpText As LongPtr, ByVal lpCaption As LongPtr, ByVal uType As Long) As Long
Sub ChangeLineSpacing(ByVal delta As Integer, ByVal undorecordname As String)
@user202729
user202729 / TeX-expandafter-repeat.md
Last active November 13, 2021 02:31
Repeat expandafter in TeX X times
@user202729
user202729 / README.md
Last active December 16, 2021 03:34
Common intermittent Selenium errors

If the error happens all the time, they're easy to fix. This is not "common Selenium errors".

Obviously it's terrible if the program only breaks after working for an hour.

  • after button click of form submit button, need to wait until page load
  • cannot click elements not inside view
  • (Firefox only) cannot click elements too large
  • JavaScript-loaded page
  • script not loaded (wait until all scripts finished loading before try to click)
  • unexpected alert present exception. (page may "randomly" decide to give announcement or something)