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
# Connect to screen session | |
case "/$(ps -p $PPID -o comm=)" in | |
*/sshd) screen -RR;; | |
esac |
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
import { download, Destination } from 'https://deno.land/x/download/mod.ts' | |
function error(msg) { | |
console.error(msg) | |
Deno.exit(1) | |
} | |
/** | |
* @param file The JSON file path | |
* @param path The JSON object path | |
* @param dest The download destination dir (optional, defaults to current) |
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' | |
}) |
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
# 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
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
#!/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
#!/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
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 |
NewerOlder