Skip to content

Instantly share code, notes, and snippets.

@thewheat
thewheat / bookmarklet.js
Created Jul 31, 2020
Epic book https://www.getepic.com/ bookmarklet to start audio book from page 1. Converted to a bookmarklet via https://mrcoles.com/bookmarklet/
View bookmarklet.js
javascript:(function()%7BpausePlayButton%20%3D%20document.querySelector(%22.read-to-me-button%22)%3BpageSlider%20%3D%20document.querySelector(%22.book-page-slider-container%20.mat-slider%22)%3BclassIndicatingPaused%20%3D%20%22paused%22%3B%2F*%20based%20on%20https%3A%2F%2Fstackoverflow.com%2Fa%2F6158160%2F723139%20*%2Ffunction%20simulatedMousedown(target%2C%20options)%20%7Bvar%20event%20%3D%20target.ownerDocument.createEvent('MouseEvents')%2Coptions%20%3D%20options%20%7C%7C%20%7B%7D%2Copts%20%3D%20%7B%20%2F*%20These%20are%20the%20default%20values%2C%20set%20up%20for%20un-modified%20left%20clicks%20*%2Ftype%3A%20'mousedown'%2CcanBubble%3A%20true%2Ccancelable%3A%20true%2Cview%3A%20target.ownerDocument.defaultView%2Cdetail%3A%201%2CscreenX%3A%200%2C%20%2F*%20The%20coordinates%20within%20the%20entire%20page%20*%2FscreenY%3A%200%2CclientX%3A%200%2C%20%2F*%20The%20coordinates%20within%20the%20viewport%20*%2FclientY%3A%200%2CctrlKey%3A%20false%2CaltKey%3A%20false%2CshiftKey%3A%20false%2CmetaKey%3A%20false%2C%20%2F*%2
@thewheat
thewheat / annotatorjs.php
Last active Jun 6, 2020
Demo file of http://annotatorjs.org/ that allows saving of annotations in a simple text file
View annotatorjs.php
<?php
define("ANNOTATIONS_FILE", "annotations.json");
$annotations = getAnnotations();
if (!$_GET || !$_GET['action']){
}
else if ($_GET['action'] == "search") {
$uri = $_GET['uri'];
@thewheat
thewheat / screen_tmux.md
Last active Oct 24, 2019
Commands for screen/tmux
View screen_tmux.md

screen

  • Ctrl + a, c: create new screen
  • Ctrl + a, a: switch to previous screen
  • Ctrl + a, ": list all screens
  • Ctrl + a, NumberX : switch to screen #NumberX
  • screen -ls: list all sessions
  • screen -rad ID: reattach

tmux

Panes

View youtube-dl.md5
# Quick start for youtube-dl
- https://github.com/ytdl-org/youtube-dl/
## Default usage
youtube-dl URL
## Download certain resolution
youtube-dl -f "best[height<=480]" URL
## Download certain extension
@thewheat
thewheat / brunei_postcodes.csv
Last active Sep 2, 2019
Brunei Postcodes extracted from http://www.post.gov.bn/SitePages/postcodes.aspx There are some without postcodes due to the server not returning any data. If you need to know which Mukim/ Kampong you're located in https://thewheat.github.io/brunei_map/ could be useful
View brunei_postcodes.csv
Number District Mukim Kampong Code
95 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 01 hingga 500 BS8670
97 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 1001 hingga 1500 BS8672
98 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 1501 hingga 2000 BS8673
99 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 2001 hingga 2500 BS8674
100 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 2501 BS8675
96 Brunei-Muara Daerah Brunei Dan Muara Peti Surat 501 hingga 1000 BS8671
107 Brunei-Muara Daerah Brunei Dan Muara Peti Surat Persendirian (Pejabat Pos Anggerek Desa) BB3713
102 Brunei-Muara Daerah Brunei Dan Muara Peti Surat Persendirian (Pejabat Pos Gadong) BE3978
108 Brunei-Muara Daerah Brunei Dan Muara Peti Surat Persendirian (Pejabat Pos Limau Manis) BH2323
@thewheat
thewheat / ffmpeg.md
Last active Mar 8, 2020
Document typical ffmpeg commands I use
View ffmpeg.md

Extract only video from file

ffmpeg -i input.mov -c:v copy -an input_video.mov

Extract only audio from file

ffmpeg -i input.mov -c:a copy -vn input_audio.aac
@thewheat
thewheat / Intercom Encrypted Mode.md
Last active Mar 10, 2020
Sample code to enable Intercom Encrypted Mode
View Intercom Encrypted Mode.md
View intercom_with_leadpages
<script>
var APP_ID = "YOUR_APP_ID";
window.intercomSettings = {
app_id: APP_ID
};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
@thewheat
thewheat / intercom_with_shopify.js
Last active Aug 29, 2018
Integrate Intercom https://intercom.com into Shopify via manual code. Supports both visitors and logged in users
View intercom_with_shopify.js
<script>
// Add this to your theme layout code after the footer
var APP_ID = "YOUR_APP_ID";
{% if customer %}
// https://help.shopify.com/en/themes/liquid/objects/customer
window.intercomSettings = {
app_id: APP_ID,
name: "{{customer.name}}",
email: "{{customer.email}}",
@thewheat
thewheat / intercom_javascript_attributes.md
Last active Aug 22, 2019
Attributes for Intercom's client side Javascript integration used when installing the messenger https://developers.intercom.com/docs/js-installation
View intercom_javascript_attributes.md

Javascript Installation Attributes

  • Intercom can be initialised with various ways For visitors
window.intercomSettings = { 
  app_id: YOUR_APP_ID
}

For Logged in users

You can’t perform that action at this time.