Skip to content

Instantly share code, notes, and snippets.

@huangyg11
huangyg11 / waitFor.js
Last active August 6, 2019 08:16 — forked from mjblay/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content. Forked for use without JQuery.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
//--- Page-specific function to do what we want when the node is found.
function commentCallbackFunction (element) {
element.text ("This comment changed by waitForKeyElements().");
@huangyg11
huangyg11 / remote-copy.md
Last active January 16, 2017 07:20 — forked from burke/remotepaste.md
This fork sets up keybindings in tmux that allow you to copy to your OS X clipboard from tmux running inside an SSH connection to a remote host. In tmux copy mode, hit enter to copy.

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@huangyg11
huangyg11 / ansible-disable-ssh-key-auth.yml
Created September 30, 2015 06:30
ansible playbook. disable ssh key auth
- hosts: all
tasks:
- name: disable ssh key auth
lineinfile:
dest: /etc/ssh/sshd_config
regexp: ^PasswordAuthentication
line: PasswordAuthentication no
notify:
restart ssh
@huangyg11
huangyg11 / ansible-disable-ssh-key-auth.yml
Created September 30, 2015 06:30
ansible playbook. disable ssh key auth
- hosts: all
tasks:
- name: disable ssh key auth
lineinfile:
dest: /etc/ssh/sshd_config
regexp: ^PasswordAuthentication
line: PasswordAuthentication no
notify:
restart ssh
@huangyg11
huangyg11 / SaveAsPdf.vbs
Last active February 9, 2016 13:47
Save word to pdf and open it with viewer
Sub SaveAsPdf()
'
'
'
Dim filename As String
filename = ActiveDocument.Path & "\" _
& CreateObject("scripting.filesystemobject").getbasename(ActiveDocument) _
& ".pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
filename, ExportFormat:= _
@huangyg11
huangyg11 / ppt2pdf_with_animations.vbs
Last active February 9, 2016 13:36
Convert ppt 2 pdf with every animation preserved. Working in mac too. From http://neilmitchell.blogspot.hk/2007/11/creating-pdf-from-powerpoint-with.html
Sub AddElements()
Dim shp As Shape
Dim i As Integer, n As Integer
n = ActivePresentation.Slides.Count
For i = 1 To n
Dim s As Slide
Set s = ActivePresentation.Slides(i)
s.SlideShowTransition.Hidden = msoTrue