KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
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
| #!/usr/bin/env bash | |
| readonly SCRIPT=$(basename "$0") | |
| readonly VERSION='1.0.0' | |
| readonly AUTHOR='xy.kong@gmail.com' | |
| readonly SOURCE='https://gist.github.com/xykong/6efdb1ed57535d18cb63aa8e20da3f4b' | |
| # For script running robust | |
| set -o nounset # to exit when your script tries to use undeclared variables | |
| set -o errexit # to make your script exit when a command fails |
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 | |
| backupfrom="/srv/smb/" | |
| blockdev=${1:-/dev/sdd1} | |
| permunlock=$(pkaction|grep org.freedesktop.udisks2.encrypted-unlock) | |
| permmount=$(pkaction|grep org.freedesktop.udisks2.filesystem-mount) | |
| if [[ -z "$permunlock" ]] || [[ -z "$permmount" ]]; then | |
| echo "enter disk password first, then login password twice" | |
| echo "login password prompts can be eliminated via polkit" |
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
| const html = document.documentElement | |
| const body = document.body | |
| /** | |
| Pseudo HTML element which behaves like a regular element in terms of scrolling. | |
| */ | |
| const documentElement = { | |
| set scrollLeft(x) { html.scrollLeft = x }, | |
| get scrollLeft() { return window.scrollX || window.pageXOffset }, | |
| set scrollTop(x) { html.scrollTop = x }, |
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 React from 'react'; | |
| import { connect } from 'react-redux'; | |
| class PageWidget extends React.Component { | |
| componentDidMount() { | |
| this.ifr.onload = () => { | |
| this.ifr.contentWindow.postMessage('hello', '*'); | |
| }; | |
| window.addEventListener("message", this.handleFrameTasks); | |
| } |
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
| {- | |
| This file is a reaction to the article "A small dive into, and rejection of, Elm": | |
| https://hackernoon.com/a-small-dive-into-and-rejection-of-elm-8217fd5da235#.9w3ml4r6b | |
| I think constructive criticism is very welcome in the Elm community. Pointing out | |
| possibilities for documentation improvements, mentioning missing features or ways | |
| in which the language could evolve etc. are imho a vital part of a good community. | |
| However, the article above is neither well informed nor constructive. IMHO ranting |
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
| // Run from the dev tools console of any Youtube video | |
| // Accurate as of July 2, 2020. | |
| // | |
| // Copy and paste this into the dev console in a browser with the desired video loaded. | |
| // | |
| // NOTE: Some Youtube videos do not directly expose the video url in the response. | |
| // This script doesn't currently attempt to handle those. It will work for most other general video types though. | |
| (async () => { | |
| const html = await fetch(window.location.href).then((resp) => resp.text()).then((text) => text); |
I was trying to understand JavaScript Promises by using various libraries (bluebird, when, Q) and other async approaches.
I read the spec, some blog posts, and looked through some code. I learned how to
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
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # |
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 | |
| VG_NAME="vg0" | |
| SNAPSHOT_SIZE="+2G" | |
| BACKUP_LOCATION="/backups" | |
| DAYSTOKEEP=7 | |
| for lv in $(lvs --noheadings --nosuffix --aligned --separator , -o lv_name,lv_attr | grep -v ,s | cut -d, -f1) | |
| do | |
| LV_SIZE="$(lvs --units m --noheadings --nosuffix --aligned --separator , -o lv_name,lv_size | grep "$lv" | cut -d',' -f2 | cut -d. -f 1)" # LV size in MB |
NewerOlder