- install tools
sudo apt update
sudo apt install -y xbindkeys xdotool
- identify mouse button numbers
sudo apt update
sudo apt install -y xbindkeys xdotool
| # Client configs, 16.04, | |
| script-security 2 | |
| up /etc/openvpn/update-resolv-conf | |
| down /etc/openvpn/update-resolv-conf | |
| # network manager, 16.04, install below package to enable import openvpn client configs | |
| sudo apt install network-manager-openvpn-gnome | |
| # Client configs, 18.04/18.10 |
| what's going to be deleted: | |
| find ~/.cache/ -depth -type f -atime +365 | |
| deleted (last accessed more than a year ago) | |
| find ~/.cache/ -type f -atime +365 -delete |
| rotate the files first so that recent entries are moved to inactive files | |
| journalctl --rotate | |
| Retain only the past two days: | |
| journalctl --vacuum-time=30d | |
| Retain only the past 500 MB: | |
| journalctl --vacuum-size=500M |
| // constants / params | |
| const key = CryptoJS.enc.Utf8.parse('example-key'); | |
| const iv = CryptoJS.enc.Utf8.parse('example-iv'); | |
| // functions | |
| function CryptJsWordArrayToUint8Array(wordArray) { // https://github.com/brix/crypto-js/issues/274 | |
| const l = wordArray.sigBytes; | |
| const words = wordArray.words; | |
| const array = new Uint8Array(l); | |
| let i=0; /*dst*/ | |
| let j=0; /*src*/ |
| <html> | |
| <head> | |
| <title>Example</title> | |
| <style> | |
| button { | |
| padding: 10px; | |
| background-color: #3C79F8; | |
| display: inline-block; | |
| } | |
| </style> |
| chrome.browserAction.onClicked.addListener(function() { | |
| chrome.tabs.create({url: 'index.html'}); | |
| }); |
| { | |
| "name": "Manifest Example", | |
| "description" : "Drive API Manifest in Chrome Extension", | |
| "version": "1.0", | |
| "permissions": [ | |
| "identity" | |
| ], | |
| "background": { | |
| "scripts": ["background.js"], | |
| "persistent": false |
| // function within window | |
| window.onload = function() { | |
| // button behaviours | |
| document.querySelector('button') | |
| .addEventListener( | |
| 'click', | |
| function() { | |
| // get Auth Token | |
| chrome.identity.getAuthToken({interactive: true}, function(token) { | |
| console.log(token); |
| var DriveBaseUrl = 'https://www.googleapis.com/'; | |
| var DriveWriteUrl = 'upload/drive/v3/files/'; | |
| // write file - update with Array Buffer | |
| fetch( | |
| DriveBaseUrl + DriveWriteUrl + fileId, | |
| { | |
| method: 'PATCH', | |
| headers: { | |
| Authorization: 'Bearer ' + token, | |
| 'Accept': 'text/plain', |