Skip to content

Instantly share code, notes, and snippets.

@huangyg11
huangyg11 / waitFor.js
Last active Aug 6, 2019 — forked from mjblay/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
View waitFor.js
/*--- 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 Jan 16, 2017 — 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.
View remote-copy.md

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 Sep 30, 2015
ansible playbook. disable ssh key auth
View ansible-disable-ssh-key-auth.yml
- 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 Sep 30, 2015
ansible playbook. disable ssh key auth
View ansible-disable-ssh-key-auth.yml
- 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 Feb 9, 2016
Save word to pdf and open it with viewer
View SaveAsPdf.vbs
Sub SaveAsPdf()
'
'
'
Dim filename As String
filename = ActiveDocument.Path & "\" _
& CreateObject("scripting.filesystemobject").getbasename(ActiveDocument) _
& ".pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
filename, ExportFormat:= _
View ppt2pdf_with_animations.vbs
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
You can’t perform that action at this time.