Skip to content

Instantly share code, notes, and snippets.

Avatar
👍
Open to work, see unforswearing/unforswearing for info!

Alvin C unforswearing

👍
Open to work, see unforswearing/unforswearing for info!
View GitHub Profile
@unforswearing
unforswearing / compton.conf
Created Aug 22, 2021 — forked from vemacs/compton.conf
Reasonable compton.conf (fixes shadows in the stock desktop environment) for Xubuntu 16.04
View compton.conf
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";
@unforswearing
unforswearing / Tiny JavaScript tokenizer.js
Created Jun 2, 2021 — forked from borgar/Tiny JavaScript tokenizer.js
A compact tokenizer written in JavaScript.
View Tiny JavaScript tokenizer.js
/*
* Tiny tokenizer
*
* - Accepts a subject string and an object of regular expressions for parsing
* - Returns an array of token objects
*
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid');
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ]
*
*/
@unforswearing
unforswearing / shellcheck.yml
Last active May 13, 2021 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
View shellcheck.yml
on:
push:
branches:
- master
name: 'shellcheck'
jobs:
shellcheck:
name: shellcheck
@unforswearing
unforswearing / google_doc_url_conversion.md
Last active Jul 4, 2019
Hack to convert Google Doc editing url
View google_doc_url_conversion.md
View gist:17f196b4278964aaa1d8f0f5001819a8
*smoothScroll.js*
*smooth*.js*
*nicescroll*js*
*jquery.mousewheel.js*
*plugins-scroll.js*
https://d33wubrfki0l68.cloudfront.net/bundles/85ee573a175fbccec4ed26bf47ede7fd06c1d248.js
View one-click-submit-google-form.md

One Click Submit a Google Form

The process below will allow you to submit a google form by clicking a single link. Documenting because I never seem to remember.

Initial steps:

  • Get the id of the form, located after the /d/e portion of the Form URL
  • Grab the textarea name from the Google Form page source. I normally do a manual search entry. and find the form field name from there.
View new-text-file-in-finder.applescript
tell application "Finder"
set FoldName to selection as text
set FoldName to POSIX path of FoldName
set newfile to text returned of (display dialog "Enter file name and extension" default answer "")
set FileName to FoldName & newfile
set FileName to POSIX path of FileName
set FileName to quoted form of FileName
do shell script "touch " & FileName
do shell script "open " & FileName
end tell
View script-launcher.applescript
set _Path to "<<enter path to your script folder here>>"
set scriptLaunch to text returned of (display dialog "Enter name of script to run" default answer "" buttons "OK" default button "OK")
if scriptLaunch contains "" then
error number -128
else if scriptLaunch contains scriptLaunch then
try
set scriptRun to _Path & "/" & scriptLaunch & ".scpt"
run script scriptRun
on error
display alert "Your script failed to launch."
View nv-new-note-from-dialog.applescript
set newnote to display dialog "Create a NV note" default answer ""
set newnote to text returned of newnote
tell application "Finder" to set the clipboard to newnote as text
tell application "Notational Velocity"
activate
tell application "System Events"
key code 9 using {command down, shift down}
key code 124 using command down
key code 36
key code 36
View copy-to-nv.applescript
tell application "System Events"
set w1 to the name of first application process whose frontmost is true
tell w1
tell application "System Events"
key code 0 using command down
key code 8 using command down
set bodytext to the clipboard
set the clipboard to bodytext as string
tell application "Notational Velocity"
activate