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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
public class arraycalc { | |
public static void main(String[] args) { | |
List<List<Object>> n = new ArrayList(); | |
n.add(Arrays.asList("A", "B", "C")); |
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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class arraycalc { | |
public static void main(String[]args){ | |
List<Integer> arr = Arrays.asList(1,2,3,4,5); | |
List<Integer> c = Arrays.asList(4,5); | |
List<List<Integer>> result = arraycalc.combinations(arr,c,new ArrayList<Integer>(),new ArrayList<List<Integer>>()); |
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 product(b): | |
result=[] | |
for i in b[0]: | |
if len(b)>1: | |
xx=product(b[1:]) | |
result+=[[i]+v for v in xx] | |
else: | |
result+=[[i]] | |
return result | |
p=product([[1,2,3],[7,8],[9,4],[5,6]]) |
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 numpy as np | |
def combinations(arr, | |
c, | |
cut=[], | |
results=[]): | |
if 0 in c: | |
results+=[cut] | |
if np.all(c<=0): | |
return results | |
for i in range(len(arr)): |
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
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier | |
# you can schedule this with launchd to run e.g. weekly | |
# Specify in seconds how long the script should record (default here is 1 hour). | |
seconds=3600 | |
# Date format for the recording file name | |
DATE=`date "+%d-%m-%y_%H-%M"` | |
# start ffmpeg recording |
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 read_m3u8(m3u8) | |
File.open(m3u8, 'r') do |file| | |
keyfile = nil | |
iv = 0 | |
file.each_line do |line| | |
line.chomp! | |
if line =~ /^#EXT-X-KEY:METHOD=AES-128,URI="(.*?)"(,IV=0x(.*))?/ | |
keyfile = $1 | |
if $2 | |
iv = $3 |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 sys, os | |
import shutil | |
from Crypto.Cipher import AES | |
def parse_m3u8_file(m3u8_file): | |
with open(m3u8_file, 'rb') as fp: | |
current_line = fp.readline().rstrip('\n') | |
while (current_line): | |
if current_line.startswith('#EXT-X-KEY'): |