Skip to content

Instantly share code, notes, and snippets.

@hupili
hupili / gen-icon.sh
Created December 3, 2015 16:05
Generate Icons for Weibo. (Resize images by imagemagick)
#!/bin/bash
if [[ $# != 1 ]]; then
echo "usage: $0 fn_input"
exit 255
else
fn_input=$1
fi
ext="${fn_input##*.}"
@hupili
hupili / imagerise.sh
Created December 3, 2015 15:39
Turn a PDF into a series of images
#!/bin/bash
if [[ $# == 1 ]]; then
fn_input=$1
else
echo "usage: $0 <fn_input>"
exit 255
fi
rm -rf tmp
@hupili
hupili / facebook.js
Created July 30, 2015 11:15
Facebook One-liners
# Select and paste useful commands into Chrome Console on FB
# Click Likes
Array.prototype.slice.call($$(".UFILikeLink[title='Like this']:not(.accessible_elem)"), 0).map(function(a){a.click()})
# Invite all friends
Array.prototype.slice.call($$("[role='checkbox']"), 0).map(function(a){a.click()})
@hupili
hupili / regen-password.sh
Created December 1, 2014 09:22
Programmably regenerate passwords for users (Ubuntu)
#!/bin/bash
# Usage: put list of users in "users" file.
# one user per line.
# Passwords will be changed and stored in "passwd.list"
rm -f passwd.list
for user in `cat users`
do
password=`echo "sdf982ci237986ahah:$user" | sha1sum | cut -c1-16`
echo $user
@hupili
hupili / show-ip.sh
Created November 28, 2014 01:42
show IPs of LXC virtual machine (for ubuntu).
#!/bin/bash
# Run this under /var/lib/lxc
for vm in `find -maxdepth 1 -type d`
do
echo $vm
grep 'address' $vm/rootfs/etc/network/interfaces
done
@hupili
hupili / README
Last active August 29, 2015 14:07 — forked from rwest/README
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@hupili
hupili / chrome-console
Created September 21, 2014 00:52
Click all likes on a Facebook page
Array.prototype.slice.call($$(".UFILikeLink[title='Like this']:not(.accessible_elem)"), 0).map(function(a){a.click()})
@hupili
hupili / chrome-console
Created September 9, 2014 05:21
Follow all Twitter users on a page
$('.user-actions-follow-button').filter(':not(.cancel-hover-style)').click()
@hupili
hupili / keybase.md
Created June 12, 2014 12:54
keybase.md

Keybase proof

I hereby claim:

  • I am hupili on github.
  • I am hpl (https://keybase.io/hpl) on keybase.
  • I have a public key whose fingerprint is A88E C9B2 2A3F 299E 8283 6885 3C96 125E 67E5 501A

To claim this, I am signing this object: