sha256 of a file
openssl sha -sha256 ws-test.js
sha256 of string
echo -n 'your string' | opsnssl sha -sha256
Random password 192 character
openssl rand 192
openssl sha -sha256 ws-test.js
echo -n 'your string' | opsnssl sha -sha256
openssl rand 192
```dataviewjs | |
let currentFilePath = dv.current().file.path; | |
let currentFileDir = dv.current().file.folder; | |
let currentSubPagesSorted = dv.pages('"' + currentFileDir + '"').sort(b => b.file.name, 'asc').values; | |
function getIndex(options) { | |
let direction = options.direction; | |
let targetIndex = 0; |
# Based on https://gist.github.com/bastibe/c0950e463ffdfdfada7adf149ae77c6f | |
# Changes: | |
# * Instead of overriding cd, we detect directory change. This allows the script to work | |
# for other means of cd, such as z. | |
# * Update syntax to work with new versions of fish. | |
function __auto_source_venv --on-variable PWD --description "Activate/Deactivate virtualenv on directory change" | |
status --is-command-substitution; and return | |
# Check if we are inside a git directory |
# Based on https://gist.github.com/bastibe/c0950e463ffdfdfada7adf149ae77c6f | |
# Changes: | |
# * Instead of overriding cd, we detect directory change. This allows the script to work | |
# for other means of cd, such as z. | |
# * Update syntax to work with new versions of fish. | |
function __auto_source_venv --on-variable PWD --description "Activate/Deactivate virtualenv on directory change" | |
status --is-command-substitution; and return | |
# Check if we are inside a git directory |
Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.
To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:
tell application "System Preferences"
set CurrentPane to the id of the current pane
set the clipboard to CurrentPane
" Substitute a:from => a:to by string. | |
" To substitute by pattern, use substitute() instead. | |
function! s:substring(str, from, to) | |
if a:str ==# '' || a:from ==# '' | |
return a:str | |
endif | |
let str = a:str | |
let idx = stridx(str, a:from) | |
while idx !=# -1 |
#!/bin/bash | |
# Batch convert videos with HandBrake CLI | |
# By Ralph Crisostomo - 2016.04.17 | |
# | |
# Usage : | |
# 'sudo ./handbrake.sh /source /destination' | |
# | |
# Reference : | |
# https://forum.handbrake.fr/viewtopic.php?f=6&t=19426 | |
# https://gist.github.com/czj/1263872 |
# -*- ksh -*- | |
# | |
# If you use the GNU debugger gdb to debug the Python C runtime, you | |
# might find some of the following commands useful. Copy this to your | |
# ~/.gdbinit file and it'll get loaded into gdb automatically when you | |
# start it up. Then, at the gdb prompt you can do things like: | |
# | |
# (gdb) pyo apyobjectptr | |
# <module 'foobar' (built-in)> | |
# refcounts: 1 |
'Find' : 'find')<CR> | |
" Find file in current directory and edit it. | |
function! Find(name) | |
let l:list=system("find . -type f | grep -i '".a:name."' | perl -ne 'print \"$.\\t$_\"'") | |
" let l:list=system("find . -iname '".a:name."' | perl -ne 'print \"$.\\t$_\"'") | |
" replace above line with below one for gvim on windows | |
" let l:list=system("find . -name ".a:name." | perl -ne \"print qq{$.\\t$_}\"") | |
let l:num=strlen(substitute(l:list, "[^\n]", "", "g")) | |
if l:num < 1 | |
echo "'".a:name."' not found" |
# encoding: utf-8 | |
""" Python General Helpers | |
Copyright (c) 2010 Kenneth Reitz. Creative Commons Attribution 3.0 License. | |
""" | |
import urllib, re, time, sys | |
import paramiko | |