Skip to content

Instantly share code, notes, and snippets.

@z720
z720 / ResetComments.bas
Created February 1, 2022 13:20
Excel Macro : Reset comments (position and size)
Attribute VB_Name = "ResetComments"
Sub ResetComments()
' ADD TO %appdata%\Microsoft\Excel\XLSTART\PERSONAL.XLSB
Dim pComment As Comment
Dim maxWidth As Integer
maxWidth = 250
For Each pComment In Application.ActiveSheet.Comments
pComment.Shape.Top = pComment.Parent.Top + 15
pComment.Shape.Left = pComment.Parent.Offset(0, 1).Left + 25
pComment.Shape.TextFrame.AutoSize = True
@z720
z720 / args.sh
Created April 9, 2021 05:07
Bash command line parsing
# from https://medium.com/@Drew_Stokes/bash-argument-parsing-54f3b81a6a8f
#!/bin/bash
PARAMS=""
while (( "$#" )); do
case "$1" in
-a|--my-boolean-flag)
MY_FLAG=0
shift
;;
Verifying that +seberard is my blockchain ID. https://onename.com/seberard
@z720
z720 / high-contrast.json
Last active March 19, 2018 08:00
high-contrast.json
[
{ "name": "white",
"iscc-nbs": 263,
"hex": "#F2F3F4" },
{ "name": "black",
"iscc-nbs": 267,
"hex": "#222222" },
{ "name": "yellow",
"iscc-nbs": 82,
"hex": "#F3C300" },
@z720
z720 / user-style-medium.css
Created December 16, 2014 11:38
Anchor Display (Medium)
a[id]:before {
display: inline-block;
width: 5em;
content: '#' attr(id);
margin-left: -5em;
text-align: right;
font-size: small;
}
@z720
z720 / post-receive
Created November 25, 2014 09:41
Post Receive hook for working copy update
#!/bin/sh
# merge the shared branch
if [ -n "$(git status --porcelain)" ]; then
echo "Working copy not cleaned, please update manually";
git status
else
git merge shared
git clean -f -d
git log --pretty=format:'%h -%d %s <%an> (%ci)' --abbrev-commit > .changelog
@z720
z720 / LdapAuth
Created April 17, 2012 20:54
Ldap authentication
// Set up the environment for creating the initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=S. User, ou=NewHires, o=JNDITutorial");
env.put(Context.SECURITY_CREDENTIALS, "mysecret");
@z720
z720 / WordPressPluginSamples
Created April 12, 2011 11:22
Change contact info for WordPress authors
function new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter'; // Add Twitter
$contactmethods['facebook'] = 'Facebook'; // Add Facebook
unset($contactmethods['yim']); // Remove Yahoo IM
unset($contactmethods['aim']); // Remove AIM
unset($contactmethods['jabber']); // Remove Jabber
return $contactmethods;
}