Skip to content

Instantly share code, notes, and snippets.

@goldengrape
goldengrape / test.m3u
Last active July 12, 2019 07:05
a m3u8 test file to play youtube video
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4000
#EXTINF:15.000000000000002,
https://r5---sn-nx5s7n7s.googlevideo.com/videoplayback?expire=1562934199&ei=VycoXYLZGOKDsfIPo8uAwAM&ip=35.233.227.153&id=o-AN1T-Q-PR_Y7K870UX0sJIWDG0dpcA-orWehY5zAM29t&itag=22&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-nx5s7n7s%2Csn-n4v7knlz&ms=au%2Conr&mv=m&mvi=4&pl=17&initcwndbps=1561250&mime=video%2Fmp4&ratebypass=yes&dur=1024.348&lmt=1538116774878707&mt=1562912515&fvip=5&c=WEB&txp=5531332&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRAIgE3G5-ooT4Yv0xd4WsGdywURNcf5LRBY-iQxgaP-EPTgCIBmPwD2o0xjmf2gK7G0nYWhllG8TOt0PStoI034v-wq9&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIhAMvOwuc9rYmecPPPH4Z264CmWw7uks5LRuQ-BeppsOdMAiANyl_afrFXtoC8YTnd55mAwQjVBxk2HLSL6vWXrmBOhg%3D%3D
#EXTINF:29.876600000000003,
https://r3---sn-nx5e6nez.googlevideo.com/videoplayback?expire=1562934200&ei=WCcoXbL2CqKEsfIPnOKR8AE&ip=35.233.227.153&id=o-ANEpAzLGAZD3IyUl-zJ1e2qljkrHGVp
//题目描述
//给定一个数组a[0,...,n-1],求其最大子数组(长度>=1)和
//
//输入描述
//第一行一个整数n(1<=n<=5000),然后依次输入n个整数(每个整数范围[-5000, 5000])
//
//输出描述
//输出一个整数表示最大子数组和
#include <iostream>
#include <assert.h>
Instruction manual
Three-stage, four-stage glass oil diffusion pump
The diffusion pump is an important part of the vacuum system, and it has a wide range of applications in the field of electric light sources.
I. Concept and division of vacuum
II. The state of a gas below 1 atmosphere is usually called vacuum, and the pressure is usually used to indicate the degree of vacuum (vacuum). The unit is Pa (Pa), millimeters of mercury (mmHg), or Torr. It is 1 Torr = 1 mmHg = 1.33x10^2Pa.
@goldengrape
goldengrape / artiphon.rb
Last active November 15, 2019 01:54
artiphon instrument1 remap key to chord by sonic-pi
artiphon_address= "/midi/instrument1/*/*/"
artiphon_synth= :dsaw
remap_hash={40 => (ring 40,45,50,55,59,64),\
41 => chord(:d4,:major),\
42 => chord(:e4,:major),\
43 => chord(:f4,:major),\
44 => chord(:g4,:major)
}
# if you want to remap keys to chords
@goldengrape
goldengrape / 按概率随机选取.rb
Last active November 16, 2019 08:14
按概率随机选取, 使用Hash table, 键=>相对概率, sonic-pi测试通过
# base from https://stackoverflow.com/a/19265735/9191373
def picker(options)
current, max = 0, options.values.inject(:+)
random_value = rrand(0,max)
options.each do |key,val|
current += val
return key if random_value <= current
end
end
##| 五线谱字典
##| 低音谱号数得恼火
def look_up_staff(clef,pos)
ns=["C","D","E","F","G","A","B"].ring
s_T=scale(:C4,:major,num_octaves: 2)
if clef.downcase == "treble" or clef.downcase=="t"
idx=((pos-(-1))*2).to_i
octave=(idx/7).to_i+4
name=ns[idx]+octave.to_s
##| modify from
# Band Example 2
# Mehackit 2016
##| http://sonic-pi.mehackit.org/exercises/chs/11-templates/03-band-example.html
use_bpm 120
live_loop :rummut do
sample :drum_heavy_kick
sleep 1
##| 经典house节奏
##| 根据learningmusic.ableton.com课程
##| https://learningmusic.ableton.com/zh/make-beats/make-beats.html
use_random_seed 10
open_hat_beat=
[0,0,1,0,
0,0,0,0,
0,0,0,0,
0,0,0,0].ring
#!/usr/bin/env python
# coding: utf-8
import pysubs2
import re
from stardict import DictCsv
# depend on https://github.com/skywind3000/ECDICT/
dict_filename="ecdict.csv"
sub_filename="01sub.srt"
//
// main.cpp
// crop_video
//
// Created by GoldenGrape on 2020/6/6.
// Copyright © 2020 goldengrape. All rights reserved.
//
#include <iostream>
#include <algorithm>