Thursday 27 July 2023

20230727: x11 forwarding on ma.sdf.org

 From <<https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely>>:

- Created /etc/ssh/sshd_config

- Added "X11Forwarding yes"

- ssh -v -X kkwoo@ma.sdf.org
- PVT: "echo $DISPLAY" shows some non-blank result
- PVT: run xeyes
- Result: R plot is OK but R View(cars$disp) is slow
- Result: firefox loads up but is pretty unresponsive. Unable to enter a web address in the location bar

Tuesday 2 February 2021

20210202: Musescore 3 jottings

  •  Useful pages
    • Ctrl-Alt-2 for voice 2 from https://musescore.org/en/handbook/3/voices
    • Use the "start beam" option on note 3 to split quavers from https://musescore.org/en/handbook/3/beams
    • https://musescore.org/en/handbook/3/lyrics
      • Ctrl-L to start lyrics
      • Space to go to next syllable
      • Ctrl-space for initial verse number separation from verse
    • https://musescore.org/en/handbook/3/note-input
      • N to enter note edit mode
      • 5 for quarter-note / crochets
      • 4 for eighth-note / quavers
      • 6 for half-note / minims
      • x to toggle tail position between up and down
      • Ctrl-UpArrow to shift note up octave
      • Ctrl-DownArrow to shift note down octave
    • https://musescore.org/en/handbook/3/viewing-and-navigation
      • Use mouse scroll wheel to move up and down score
      • Use Shift-mouse scroll to move left and right across score
    • https://musescore.org/en/node/303625
      • To flip a note tail, select the note and press 'x'
    • https://musescore.org/en/handbook/2/slurs
      • out of edit mode, click a note and press 's'
    • https://musescore.org/en/handbook/3/tuplets
      • use Ctrl-3 for tuplets
      • particularly for quarter note triplets: n 6 Ctrl-3

Monday 11 January 2021

20210112: follow the instructions very carefully for clean-webpack-plugin

 From <<https://stackoverflow.com/questions/56567930/typeerror-cleanwebpackplugin-is-not-a-constructor>>:

  • clean-webpack-plugin needs to be imported in a very specific way

20200112: sudo not recognising my password

 From <<https://askubuntu.com/questions/711663/sudo-doesnt-recognize-correct-password>>:

I had to log into the virtual terminal via my username and run passwd username to get a new password. The surprising thing was that changing the password helped when i am extremely confident about my previous password.

answered Dec 21 '15 at 16:30
user221478

 

I thought this was illogical until I tried it and found it worked.

Sunday 10 January 2021

20210111: admin powershell in Windows Terminal

 From <<https://stackoverflow.com/questions/62496779/opening-up-windows-terminal-with-elevated-privileges-from-within-windows-termin>>:

  • Created a shortcut to Windows Terminal
  • Set "Run as Administrator" in the shortcut
  • Pin the shortcut to the taskbar
  • move the shortcut to a tidy place for all taskbar shortcuts

Friday 11 December 2020

Vanguard unit price plotting

  • I want to keep track of particular Vanguard ETFs
  • The Vanguard website doesn't let me track multiple ETFs
  • Turns out the Vanguard website relies on an externally exposed API
  • Along the way I picked up
    • JQuery
    • Plotly
  • https://vanguardplotly.kkwoo.repl.co/

Diceware offsite

  • I want to create passwords using my browser
  • Diceware is good
  • Not having physical dice and the Diceware list is inconvenient
  • I have a JS page on this blog already but I wanted to publish elsewhere
  • So I copied it to https://diceware-atyourownrisk.kkwoo.repl.co/

Chaos Theory Flash Game

  • There's a Flash game I like but Flash won't be supported past Dec-2020
  • I wrote a cut-down version with HTML5 at https://chaos-theory-flash.kkwoo.repl.co/
  • There were a few challenges
    • Getting started
    • Learning the following from scratch
      • HTML5
      • CSS
      • JS
      • Suitable libraries
        • At first I went with phaser and other game libraries
        • I departed from game libraries because they were suited to platform games and other traditional games involving a protagonist player and enemies 
        • So I chose Pixi.js
      • Pixi.js
      • GSAP
    • Limited concentration time
    • This led to increased planning
    • Resulted in several minimum viable products
      • Learning pixi.js
        • Get the quickstart working
        • Get shape sprites working
        • Get containers working
      • Get collision detection working
        • Copy/paste spicyoghurt code
      • Get tweening working
        • GSAP piece
      • Construct game logic
        • Something to play the game once
      • Add a main screen
      • Add a link to start a new game
        • I did this only because I'm tired of hitting reload on the browser and wasting mobile data
    • Next steps are
      • make it more like the original
        • Cool comments/insults based on scoring
        • 3 rounds instead of 1
      • refactor the code because it's terrible design
    • However, I'm content with the game as it now stands

"npx degit sveltejs/template abc" resulting in "could not fetch remote https://github.com/sveltejs/template"

  • at first I thought it was a firewall issue
  • I banged away trying different things including stopping the firewall
  • none of this worked because the firewall wasn't the problem
  • I was too thick to stop and walk away
  • instead I took the kids to swimming class
  • afterwards, I was playing around and ran "npx degit" for fun and induced an error and discovered:
    • (Use `node --trace-warnings ...` to show where the warning was created)
  • I ran "npx --trace-warnings degit sveltejs/template abc" which gave:
    • npm ERR! code ENOENT
      npm ERR! syscall spawn git
      npm ERR! path git
      npm ERR! errno -2
      npm ERR! enoent Error while executing:
      npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/sveltejs/template.git
      npm ERR! enoent
      npm ERR! enoent
      npm ERR! enoent spawn git ENOENT
      npm ERR! enoent This is related to npm not being able to find a file.
      npm ERR! enoent

      npm ERR! A complete log of this run can be found in:
      npm ERR!     /root/.npm/_logs/2020-12-12T04_25_29_798Z-debug.log
  • At first, I thought I was missing ssh
  • Then I discovered I was missing git
  • Running "npx --trace-warnings degit sveltejs/template proj02" resulted in failure
    • command not found: template
  • But once I removed "--trace-warnings" I had success:
    • DESKTOP-NNBAUML:~# npx  degit sveltejs/template proj01
      > cloned sveltejs/template#master to proj01

Friday 22 May 2020

3 Auto-Resizing Graphs in JSFiddle

Refer to:

https://jsfiddle.net/kkwoo/m5jL8yhz/41/

Techniques used:
-  "height: 30vh;" in the CSS
-  "Plotly.Plots.resize(document.getElementById("output02a"));" on graphs requiring automatic resizing

Sources:
- https://stackoverflow.com/questions/1575141/how-to-make-a-div-100-height-of-the-browser-window
- https://bl.ocks.org/etpinard/edc678711ca231a8a4a5

Sunday 12 January 2020

20200113: Installing Notepad++ 7.6 plugins

From <https://stackoverflow.com/questions/40015350/how-to-install-a-notepad-plugin-offline>:

Here are the steps that worked for me:
  1. Download the plugin and extract the plugin dll file.
  2. Place the plugin.dll file under plugin folder of notepad++ installation. For me it was : C:\Program Files\Notepad++\plugins
    • For me, I had to create a separate subdirectory under the plugins directory and place the DLL in the separate subdirectory
  3. Go to Notepad++ then : Settings -> Import -> Import plugin (import the plugin).
  4. Notepad++ will show the restart message / Sometimes it may not show it.
  5. Restart the notepad++.
  6. Should see new plugin under the Plugins menu. ALL DONE!!

Monday 6 January 2020

20200107 - for-each in Google Script

Refer to <https://stackoverflow.com/questions/46693496/for-each-loop-in-google-apps-script>:

In Google Apps Script:
When using "for (var item in itemArray)",
'item' will be the indices of itemArray throughout the loop (0, 1, 2, 3, ...).

When using "for each (var item in itemArray)",
'item' will be the values of itemArray throughout the loop ('item0', 
'item1', 'item2', 'item3', ...).