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 python3 | |
| import os | |
| import re | |
| import subprocess | |
| from natsort import natsorted | |
| import pysrt | |
| def get_video_duration(video_path): | |
| """Get video duration in milliseconds using ffprobe""" | |
| cmd = [ |
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
| console.log('works from gist') |
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
| set deviceName to "AirPods 2021" | |
| tell application "System Events" to tell process "Control Center" | |
| set i to 1 | |
| repeat with anElement in menu bar items of menu bar 1 | |
| if description of anElement is "Sound" then | |
| exit repeat | |
| end if | |
| set i to i + 1 | |
| end repeat | |
| click (menu bar item i) of menu bar 1 |
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 copySelectedPhabs = () => { | |
| let selection = window.getSelection(); | |
| if (selection.rangeCount <= 0) { | |
| return | |
| } | |
| const div = document.createElement('div') | |
| Array.from(document.querySelectorAll('.phui-oi-frame')) | |
| .filter(el => selection.containsNode(el, true)) | |
| .forEach(el => { | |
| const tmp = el.cloneNode(true) |
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 mouseEvent = document.createEvent('MouseEvents') | |
| mouseEvent.initEvent('click', true, true) | |
| const COLLAPSE_FILE = 'Hide Changeset' | |
| const EXPAND_FILE = 'Expand File' | |
| const getOptionsButton = (element) => { | |
| const links = [...element.getElementsByTagName('a')].filter(link => link.innerHTML.search('View Options') > -1) | |
| if (links.length <= 0) { | |
| throw new Error('Now Option Button Found!') | |
| } |
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 test = ` | |
| The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. | |
| The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. | |
| The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. | |
| The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. | |
| The maximum size (in bytes) of each individual item |
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
| n = int(input()) | |
| prices = [int(i) for i in input().split()] | |
| d = { x: i for i, x in enumerate(prices) } | |
| sorted_prices = sorted(prices) | |
| pairs = [ i - j for i, j in zip(sorted_prices[1:], sorted_prices[:-1]) if d[i] < d[j] ] | |
| print(min(pairs)) |
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
| public class Hello { | |
| public enum Test { | |
| A("A"), B("B"), C("C"), D("D"); | |
| public static String a = "a"; | |
| { | |
| System.out.println("Hi Test"); | |
| } | |
| Test(String test) { |
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
| class MyIter implements Iterator { | |
| private Iter a; | |
| private Iter b; | |
| private Integer common; | |
| public MyIter(Iter a, Iter b) { | |
| if (a == null || b == null) { | |
| throw new Exceptin("Null"); | |
| } |
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
| def is_prime(n): | |
| return [1 for i in range(2, n) if n % i is 0] == [] | |
| print [i for i in range(2, 100) if is_prime(i)] |
NewerOlder