This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
/** | |
* AES file encryption with authentication (using Promises) | |
* (C) Habib Rehman 2016 | |
******************************/ | |
const encrypt = function (origpath, destpath, key) { | |
// decrypts any arbitrary data passed with the pass | |
return new Promise(function (resolve, reject) { | |
// readstream to read the (unencrypted) file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
set passedInURL to (item 1 of argv) | |
tell application "Google Chrome" | |
set windowList to every tab of every window whose URL starts with passedInURL | |
repeat with tabList in windowList | |
set tabList to tabList as any | |
repeat with tabItr in tabList | |
set tabItr to tabItr as any | |
delete tabItr | |
end repeat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
set passedInURL to (item 1 of argv) | |
tell application "Google Chrome" | |
set activeIndex to get active tab index of window 1 | |
tell window 1 | |
set newTab to make new tab with properties {URL:passedInURL} | |
end tell | |
set active tab index of window 1 to activeIndex | |
end tell | |
end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
set -x | |
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f2 | sed 's/@.*//g') | |
do | |
npm -g install "$package@latest" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for proc in "$@" | |
do | |
RUNNING=$(pgrep $proc) | |
if [[ $RUNNING ]] | |
then | |
# do stuff if running | |
echo "$proc is running" | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
set passedInURL to (item 1 of argv) | |
tell application "Safari" | |
set windowCount to number of windows | |
repeat with x from 1 to windowCount | |
set tabCount to number of tabs in window x | |
repeat with y from 1 to tabCount | |
set thistab to tab y of window x | |
set thisURL to URL of thistab | |
if passedInURL is in thisURL then close thistab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FileSearch | |
function f() { find . -iname "*$1*" ${@:2} } | |
# File removal by name | |
function frm() { find . -iname "*$1*" -print0 | xargs -0 rm -r } | |
# File content search | |
function fr() { grep "$1" ${@:2} -R . } | |
# mkdir and cd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sleepInterval = 2200; | |
var sleep = 0; | |
function finda(txt) { | |
let finds = Array.from(document.querySelectorAll('a')) | |
.filter(el => el.textContent.includes(txt)) | |
console.log(txt + ': ' + finds.length) | |
return finds | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let folderId | |
const parentFolderId = '' | |
const folderName = '' | |
// Check if folder already exists | |
const folderSearch = await drive.files.list({ | |
q: `mimeType = 'application/vnd.google-apps.folder' and name = '${folderName}' and '${parentFolderId}' in parents`, | |
fields: 'nextPageToken, files(id, name)', | |
spaces: 'drive' | |
}) |
OlderNewer