Skip to content

Instantly share code, notes, and snippets.

View kumarasinghe's full-sized avatar

Naveen Kumarasinghe kumarasinghe

  • Colombo, Sri Lanka
View GitHub Profile
@kumarasinghe
kumarasinghe / wvdiald.pl
Last active August 30, 2022 16:15
wvdial daemon : Auto Connect USB modems / Mobile Broadbands on Linux / Raspberry Pi
#!/usr/bin/perl -l
# wvdiald.pl - Auto connect USB modems on Linux
# Author: naveenk <dndkumarasnghe@gmail.com>
# License: MIT
# Make sure you have wvdial and usb-modeswitch installed. Fill the connection parameters below.
# Run this as root. Add "perl /path/to/wvdiald.pl" to /etc/rc.local to make this a service
######################### CHANGE AS NEEDED ################################
# connection parameters
@kumarasinghe
kumarasinghe / ajax_form_post.js
Last active April 14, 2020 07:09
AJAX HTML form POST
/*
Invalid data will cause the server to silently reject your POST request.
Analyze the POST request on form submission via Chrome Dev tools.
*/
(async () => {
// create a form data object
let form = new FormData()
@kumarasinghe
kumarasinghe / ChromeExtensionContentScript.js
Created May 29, 2019 17:16
Chrome Extension Content Script Access Global Variables & manipulate DOM
function executeOnPageSpace(code){
// create a script tag
var script = document.createElement('script')
script.id = 'tmpScript'
// place the code inside the script. later replace it with execution result.
script.textContent =
'document.getElementById("tmpScript").textContent = JSON.stringify(' + code + ')'
// attach the script to page
document.documentElement.appendChild(script)