Skip to content

Instantly share code, notes, and snippets.

@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
@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
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.
//题目描述
//给定一个数组a[0,...,n-1],求其最大子数组(长度>=1)和
//
//输入描述
//第一行一个整数n(1<=n<=5000),然后依次输入n个整数(每个整数范围[-5000, 5000])
//
//输出描述
//输出一个整数表示最大子数组和
#include <iostream>
#include <assert.h>
@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
import webvtt
import pandas as pd
filename="en.vtt"
time_epsilon=pd.Timedelta('00:00:00.1')
vtt=webvtt.read(filename)
df=pd.DataFrame([[pd.to_datetime(v.start),
pd.to_datetime(v.end),
@goldengrape
goldengrape / learnmusic.py
Created December 9, 2018 21:17
learnmusic.py
#! python2
# NOTE: The first line in this script specifies that it should always be run using Python 2.7.
# The `midiutil` module is currently not available for Python 3.
'''Generates a MIDI file with 12 random notes in C major, using the midiutil module. The instrument is also picked randomly. The result is then played with the sound.MIDIPlayer class.
If nothing happens, make sure that your device isn't muted.
'''
from midiutil.MidiFile import MIDIFile
@goldengrape
goldengrape / learnmusic.py
Created December 9, 2018 20:43
learnmusic.py
#! python2
# NOTE: The first line in this script specifies that it should always be run using Python 2.7.
# The `midiutil` module is currently not available for Python 3.
'''Generates a MIDI file with 12 random notes in C major, using the midiutil module. The instrument is also picked randomly. The result is then played with the sound.MIDIPlayer class.
If nothing happens, make sure that your device isn't muted.
'''
from midiutil.MidiFile import MIDIFile
@goldengrape
goldengrape / Simple Play and Say.scpt
Last active September 11, 2021 14:50
Simple Play and Say.scpt
property defaultSlideDuraton : 2
property pauseBeforeSpeaking : 0 -- 1.5
property stoppingStatement : "[[slnc 1000]] Stopping presentation."
-- my startRecordScreen
tell application "QuickTime Player"
activate
set newScreenRecording to new screen recording
tell newScreenRecording
start
部分药品援助项目信息
A、中华慈善总会
1、格列卫全球患者援助项目
针对病种:贫困慢性粒细胞白血病患者、急性淋巴细胞白血病患者、恶性胃肠道间质瘤患者及隆突性皮肤纤维肉瘤
项目网址:https://gipap.org.cn
项目热线:400-606-1022
2、多吉美患者援助项目
针对病种:肾癌、肝癌
项目网址:www.ncpap.com.cn