Skip to content

Instantly share code, notes, and snippets.

@bitboxx
bitboxx / Javascript: HTML to text
Created January 13, 2014 15:11
Javascript function that convert HTML to plain text
// converts HTML to text using Javascript
function html2text(html) {
var tag = document.createElement('div');
tag.innerHTML = html;
return tag.innerText;
}
@bitboxx
bitboxx / README.md
Created February 1, 2020 06:01 — forked from ethack/TypeClipboard.md
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.

@bitboxx
bitboxx / gist:00d9fe0a8cd3189c337e8fecbec02905
Created November 29, 2017 15:20
Chrome flags to disable CORS and SSL check (high security risk, only run for testing)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors --disable-web-security --user-data-dir
@bitboxx
bitboxx / gist:5151870
Created March 13, 2013 13:06
Javascript / jQuery: Detect page change using AJAX; auto refresh if the page is updated
// Detect page change / auto refresh
$(document).ready(function() {
var currenthtml;
var latesthtml;
$.get(window.location.href, function(data) {
currenthtml = data;
latesthtml = data;
});
@bitboxx
bitboxx / osx_ramdisk.sh
Last active August 23, 2018 09:08 — forked from jnschulze/osx_ramdisk.sh
Create Ramdisk on Mac
#!/bin/bash
MOUNT_PATH=~/tmp/RamDiskCache
mkdir -p ${MOUNT_PATH}
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://8388608`
echo "Ramdisk device: ${DISK}"
@bitboxx
bitboxx / gist:9ff53b40b5112282ef6919dc4d524cb3
Created January 7, 2018 17:36
Erase and upload firmware on ESP8266 using esptool.py
# Remember to change the serial device
# Erase flash
esptool.py --port COM3 erase_flash
# Upload
esptool.py --port COM3 write_flash -fs 1MB -fm dout 0x0 firmware.bin
@bitboxx
bitboxx / .gitignore
Last active August 11, 2017 13:27
My standard .gitignore
# Mac OSX Files
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
@bitboxx
bitboxx / gist:3834818cf2b6331c4ff386212eb53f05
Created May 30, 2017 10:19
Set MacOS Keyboard repeat rate
# In terminal
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 20
# Then logout / login or restart
@bitboxx
bitboxx / copyListToClipboard.js
Last active February 27, 2017 08:55
Copy list on a website to clipboard
// Get certain list from website and copy it to clipboard
window.copyListToClipboard = (selector, elementProperty, linePrefix = '') => {
let list = '';
document.querySelectorAll(selector).forEach(element => {
list += linePrefix + element.getAttribute(elementProperty) + '\n';
});
copy(list);
}
@bitboxx
bitboxx / gist:bd62069b95bc7b2dd67d35e1bed51dd3
Created February 20, 2017 16:35
My standard ZSH user configuration
# Filename: /etc/skel/.zshrc
# Purpose: config file for zsh (z shell)
# Authors: (c) grml-team (grml.org)
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
################################################################################
# Nowadays, grml's zsh setup lives in only *one* zshrc file.
# That is the global one: /etc/zsh/zshrc (from grml-etc-core).
# It is best to leave *this* file untouched and do personal changes to
# your zsh setup via ${HOME}/.zshrc.local which is loaded at the end of