Skip to content

Instantly share code, notes, and snippets.

Avatar

David Parker boldfacedesign

View GitHub Profile
@boldfacedesign
boldfacedesign / weinre script tag
Created Jun 9, 2016
Inject weinre script tag
View 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
Take a colour hex and return a base64 image string in gif format
View hex64
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));
}
View gist:c590da3f0ffb87e069ab
COMMAND + ALT + [
COMMAND + ALT + ]
View 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 Aug 29, 2015 — forked from ebidel/imports_timing.js
HTML Imports Resource Timing performance
View imports_timing.js
// 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');
});
});
View 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 Jun 4, 2014
Create symlink to executable files
View .exe symlink
@boldfacedesign
boldfacedesign / Excel GUID Macro
Created Jun 2, 2014
Excel Macro - Fill blank cells with GUID (VBA)
View Excel GUID Macro
Sub fillBlankGUIDs()
For Each c In Selection
If IsEmpty(c.Value) Then c.Value = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36)
Next
End Sub