Skip to content

Instantly share code, notes, and snippets.

View boldfacedesign's full-sized avatar

David Parker boldfacedesign

View GitHub Profile
@boldfacedesign
boldfacedesign / weinre script tag
Created June 9, 2016 09:09
Inject weinre script tag
var weinre_script = document.createElement("script");
weinre_script.type = "text/javascript";
weinre_script.src = "http://xxx.xx.xx.xx:8855/target/target-script-min.js#anonymous";
var head = document.getElementsByTagName('head')[0];
head.appendChild(weinre_script);
// replace xxx with IP adress
@boldfacedesign
boldfacedesign / hex64
Last active May 27, 2016 07:50
Take a colour hex and return a base64 image string in gif format
hex64: function(hex) {
function encodeHex(s) {
s = s.substring(1, 7);
if (s.length < 6) {
s = s[0] + s[0] + s[1] + s[1] + s[2] + s[2];
}
return encodeRGB(
parseInt(s[0] + s[1], 16), parseInt(s[2] + s[3], 16), parseInt(s[4] + s[5], 16));
}
@boldfacedesign
boldfacedesign / Show SSH public key
Created September 11, 2015 13:08
Show SSH public key
cat ~/.ssh/id_rsa.pub
COMMAND + ALT + [
COMMAND + ALT + ]
@boldfacedesign
boldfacedesign / Git squash commits
Created July 30, 2015 08:44
Git squash commits
# Reset the current branch to the commit just before the last 12:
git reset --hard HEAD~12
# HEAD@{1} is where the branch was just before the previous command.
# This command sets the state of the index to be as it would just
# after a merge from that commit:
git merge --squash HEAD@{1}
# Commit those squashed changes. The commit message will be helpfully
# prepopulated with the commit messages of all the squashed commits:
@boldfacedesign
boldfacedesign / imports_timing.js
Last active August 29, 2015 14:26 — forked from ebidel/imports_timing.js
HTML Imports Resource Timing performance
// Know how fast your HTML Imports are
var imports = document.querySelectorAll('link[rel="import"]');
[].forEach.call(imports, function(link) {
var entries = performance.getEntriesByName(link.href);
console.info('=== HTML Imports perf ===');
entries.forEach(function(e) {
console.log(e.name, 'took', e.duration, 'ms');
});
});
@boldfacedesign
boldfacedesign / Restart OS X from terminal
Created July 1, 2015 21:04
Restart OS X from terminal
sudo shutdown -r now
@boldfacedesign
boldfacedesign / chmod numeric codes
Created January 30, 2015 20:12
chmod numeric codes
0 == --- == no access
1 == --x == execute
2 == -w- == write
3 == -wx == write / execute
4 == r-- == read
5 == r-x == read / execute
6 == rw- == read / write
7 == rwx == read / write / execute
@boldfacedesign
boldfacedesign / .exe symlink
Created June 4, 2014 10:46
Create symlink to executable files
@boldfacedesign
boldfacedesign / Excel GUID Macro
Created June 2, 2014 14:01
Excel Macro - Fill blank cells with GUID (VBA)
Sub fillBlankGUIDs()
For Each c In Selection
If IsEmpty(c.Value) Then c.Value = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36)
Next
End Sub