├── Kivy ├── RGB2Gray │ ├── new │ ├── My.kv │ └── RGB2Gray.py ├── MultiLayouts │ ├── Gif0.gif │ ├── Gif1.gif │ ├── Kivy-multi-layouts.py │ └── Kivy-multi-layouts-0402.py ├── Tutorial1 │ ├── kivy-logo.png │ ├── kivyExample.py │ └── kivyExample2.py └── Game-Snake │ └── KivySnake20180408.py ├── MATLAB └── GUI │ ├── RGB2Gray │ ├── a │ ├── RBG2Gray.fig │ └── RBG2Gray.m │ └── SoundRecorder │ ├── SoundRecorderDemo.fig │ └── SoundRecorderDemo.m ├── README.md ├── snow ├── images │ ├── wa1.jpg │ ├── snow10.png │ ├── snow15.png │ └── snow20.png └── SnowCSSAnimation.html ├── 3hearts ├── heart-pink.png ├── heart-red.png ├── heart-orange.png └── 3hearts.html ├── KivyGifSlide ├── Gif0.gif ├── Gif2.gif ├── Gif3.gif ├── Gif4.gif └── Kivy-Gif-slide.py ├── SevenDayRank ├── 山里一泼猴.jpg ├── 盒饭工作室.jpg ├── 这里有蜘蛛.jpg ├── 隔壁街老王.jpg ├── Christer.jpg ├── MrChinico.jpg ├── SuperPaxxs.jpg ├── CodeSamaLogo.png ├── SevenDayRank.html └── SevenDayRank2.html ├── wordcloud ├── CodeSamaLogoP.png ├── worldcloudCodeSamaLogo20180402.html └── worldcloudCodeSamaLogo.html ├── ImageProcessing └── People Density │ ├── people.avi │ └── PeopleGMMExample20180326.m ├── LICENSE ├── eclipse └── Eclipse20180201.html ├── kivy_KeyboardEvent ├── Kivy-Keyboard2.py └── Kivy-Keyboard-unbind.py ├── SevenDayRankPython ├── SevenDayRankUpdate.py └── SevenDayRankTemplate.html └── ParticleWebMouse ├── ParticleWeb.html └── ParticleWebMouse-large.html /Kivy/RGB2Gray/new: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MATLAB/GUI/RGB2Gray/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bilibili346623 2 | Examples shown in Bilibili Live 346623 3 | -------------------------------------------------------------------------------- /snow/images/wa1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/snow/images/wa1.jpg -------------------------------------------------------------------------------- /3hearts/heart-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/3hearts/heart-pink.png -------------------------------------------------------------------------------- /3hearts/heart-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/3hearts/heart-red.png -------------------------------------------------------------------------------- /KivyGifSlide/Gif0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/KivyGifSlide/Gif0.gif -------------------------------------------------------------------------------- /KivyGifSlide/Gif2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/KivyGifSlide/Gif2.gif -------------------------------------------------------------------------------- /KivyGifSlide/Gif3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/KivyGifSlide/Gif3.gif -------------------------------------------------------------------------------- /KivyGifSlide/Gif4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/KivyGifSlide/Gif4.gif -------------------------------------------------------------------------------- /SevenDayRank/山里一泼猴.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/山里一泼猴.jpg -------------------------------------------------------------------------------- /SevenDayRank/盒饭工作室.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/盒饭工作室.jpg -------------------------------------------------------------------------------- /SevenDayRank/这里有蜘蛛.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/这里有蜘蛛.jpg -------------------------------------------------------------------------------- /SevenDayRank/隔壁街老王.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/隔壁街老王.jpg -------------------------------------------------------------------------------- /snow/images/snow10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/snow/images/snow10.png -------------------------------------------------------------------------------- /snow/images/snow15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/snow/images/snow15.png -------------------------------------------------------------------------------- /snow/images/snow20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/snow/images/snow20.png -------------------------------------------------------------------------------- /3hearts/heart-orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/3hearts/heart-orange.png -------------------------------------------------------------------------------- /SevenDayRank/Christer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/Christer.jpg -------------------------------------------------------------------------------- /Kivy/MultiLayouts/Gif0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/Kivy/MultiLayouts/Gif0.gif -------------------------------------------------------------------------------- /Kivy/MultiLayouts/Gif1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/Kivy/MultiLayouts/Gif1.gif -------------------------------------------------------------------------------- /SevenDayRank/MrChinico.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/MrChinico.jpg -------------------------------------------------------------------------------- /SevenDayRank/SuperPaxxs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/SuperPaxxs.jpg -------------------------------------------------------------------------------- /wordcloud/CodeSamaLogoP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/wordcloud/CodeSamaLogoP.png -------------------------------------------------------------------------------- /Kivy/Tutorial1/kivy-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/Kivy/Tutorial1/kivy-logo.png -------------------------------------------------------------------------------- /SevenDayRank/CodeSamaLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/SevenDayRank/CodeSamaLogo.png -------------------------------------------------------------------------------- /MATLAB/GUI/RGB2Gray/RBG2Gray.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/MATLAB/GUI/RGB2Gray/RBG2Gray.fig -------------------------------------------------------------------------------- /ImageProcessing/People Density/people.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/ImageProcessing/People Density/people.avi -------------------------------------------------------------------------------- /MATLAB/GUI/SoundRecorder/SoundRecorderDemo.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataXujing/Bilibili346623/master/MATLAB/GUI/SoundRecorder/SoundRecorderDemo.fig -------------------------------------------------------------------------------- /Kivy/Tutorial1/kivyExample.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.button import Button 3 | 4 | class TestApp(App): 5 | def build(self): 6 | return Button(text='Hello World!') 7 | 8 | TestApp().run() 9 | -------------------------------------------------------------------------------- /Kivy/RGB2Gray/My.kv: -------------------------------------------------------------------------------- 1 | #:kivy 1.1.0 2 | : 3 | BoxLayout: 4 | size: root.size 5 | pos: root.pos 6 | orientation: "vertical" 7 | FileChooserIconView: 8 | id: filechooser 9 | rootpath:root.cwdir 10 | filters:['*.jpg','*.png','*.bmp'] 11 | 12 | BoxLayout: 13 | size_hint_y: None 14 | height: 30 15 | Button: 16 | text: "Cancel" 17 | on_release: root.cancel() 18 | 19 | Button: 20 | text: "Load" 21 | on_release: root.load(filechooser.path, filechooser.selection) -------------------------------------------------------------------------------- /Kivy/Tutorial1/kivyExample2.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.label import Label 4 | from kivy.uix.image import Image 5 | 6 | labelStr=''' 7 | [b]Kivy Logo![/b] 8 | by CodeSama@bilibili.com 9 | ''' 10 | 11 | class TestApp(App): 12 | def build(self): 13 | self.title="Kivy Logo" 14 | 15 | layout = GridLayout(cols=1) 16 | lab = Label(text=labelStr,markup=True, 17 | font_size='30sp',size_hint_y=None, height=100) 18 | img = Image(source='.\\kivy-logo.png') 19 | 20 | layout.add_widget(lab) 21 | layout.add_widget(img) 22 | return layout 23 | 24 | TestApp().run() 25 | -------------------------------------------------------------------------------- /3hearts/3hearts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CSS Animation: 3 moving hearts! 5 | 31 | 32 | 33 | 35 | 37 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CodeSama346623 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /snow/SnowCSSAnimation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 30 | 31 | 32 | 33 |
34 | 35 | 魔都.jpg 36 | 37 |
38 |
39 | 40 | -------------------------------------------------------------------------------- /eclipse/Eclipse20180201.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CSS 月食动画 6 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Kivy/MultiLayouts/Kivy-multi-layouts.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.image import AsyncImage 4 | from kivy.uix.label import Label 5 | from kivy.uix.button import Button 6 | 7 | 8 | class LayoutTest1(GridLayout): 9 | def __init__(self): 10 | GridLayout.__init__(self,cols=1) 11 | label=Label(text="Kivy Layout1",font_size='30sp', 12 | size_hint_y=None, height=100) 13 | self.add_widget(label) 14 | gifimg=AsyncImage(source=".\\Gif0.gif",anim_delay=30/1000) 15 | self.add_widget(gifimg) 16 | 17 | btn=Button(text="switch to Layout 2", 18 | size_hint_y=None, height=100) 19 | btn.bind(on_press=self.changeLayout) 20 | self.add_widget(btn) 21 | def changeLayout(self,instance): 22 | approot.root.clear_widgets() 23 | approot.root.add_widget(LayoutTest2()) 24 | 25 | class LayoutTest2(GridLayout): 26 | def __init__(self): 27 | GridLayout.__init__(self,cols=3) 28 | self.add_widget(Label(text="Layout 2",font_size='30sp', 29 | size_hint_x=None, width=150)) 30 | gifimg=AsyncImage(source=".\\Gif1.gif",anim_delay=30/1000) 31 | self.add_widget(gifimg) 32 | 33 | btn=Button(text="switch to Layout 1", 34 | size_hint_x=None, width=150) 35 | btn.bind(on_press=self.changeLayout) 36 | self.add_widget(btn) 37 | def changeLayout(self,instance): 38 | approot.root.clear_widgets() 39 | approot.root.add_widget(LayoutTest1()) 40 | 41 | class TestApp(App): 42 | def build(self): 43 | self.title="Kivy Multiple Layouts" 44 | return LayoutTest1() 45 | 46 | approot=TestApp() 47 | approot.run() 48 | 49 | -------------------------------------------------------------------------------- /Kivy/MultiLayouts/Kivy-multi-layouts-0402.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.image import AsyncImage 4 | from kivy.uix.label import Label 5 | from kivy.uix.button import Button 6 | 7 | 8 | class LayoutTest1(GridLayout): 9 | def __init__(self): 10 | GridLayout.__init__(self,cols=1) 11 | label=Label(text="Kivy Layout1",font_size='30sp', 12 | size_hint_y=None, height=100) 13 | self.add_widget(label) 14 | gifimg=AsyncImage(source=".\\Gif0.gif",anim_delay=30/1000) 15 | self.add_widget(gifimg) 16 | 17 | btn=Button(text="switch to Layout 2", 18 | size_hint_y=None, height=100) 19 | btn.bind(on_press=self.changeLayout) 20 | self.add_widget(btn) 21 | def changeLayout(self,instance): 22 | print('1',self,self.parent,self.parent.children) 23 | self.parent.add_widget(LayoutTest2()) 24 | self.parent.remove_widget(self) 25 | #self.clear_widgets() 26 | #self.add_widget(LayoutTest2()) 27 | 28 | class LayoutTest2(GridLayout): 29 | def __init__(self): 30 | GridLayout.__init__(self,cols=3) 31 | self.add_widget(Label(text="Layout 2",font_size='30sp', 32 | size_hint_x=None, width=150)) 33 | gifimg=AsyncImage(source=".\\Gif1.gif",anim_delay=30/1000) 34 | self.add_widget(gifimg) 35 | 36 | btn=Button(text="switch to Layout 1", 37 | size_hint_x=None, width=150) 38 | btn.bind(on_press=self.changeLayout) 39 | self.add_widget(btn) 40 | def changeLayout(self,instance): 41 | print('2',self,self.parent,self.parent.children) 42 | self.parent.add_widget(LayoutTest1()) 43 | self.parent.remove_widget(self) 44 | 45 | class TestApp(App): 46 | def build(self): 47 | self.title="Kivy Multiple Layouts" 48 | print (self) 49 | return LayoutTest1() 50 | 51 | approot=TestApp() 52 | print("approot"+str(approot)) 53 | approot.run() 54 | 55 | -------------------------------------------------------------------------------- /kivy_KeyboardEvent/Kivy-Keyboard2.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.label import Label 4 | from kivy.uix.image import Image, AsyncImage 5 | ##from kivy.core.window import Keyboard 6 | from kivy.core.window import Window 7 | 8 | # keycode 9 | # https://kivy.org/docs/_modules/kivy/core/window.html 10 | 11 | 12 | gifFilename=[".\\Gif2.gif",".\\Gif3.gif",".\\Gif4.gif"] 13 | giflistlen=len(gifFilename) 14 | 15 | 16 | class TestApp(App): 17 | def build(self): 18 | self.title="Kivy Logo" 19 | self.gifindexnow=0 20 | 21 | layout = GridLayout(cols=1) 22 | self.lab = Label(text=gifFilename[self.gifindexnow],markup=True, 23 | font_size='30sp',size_hint_y=None, height=100) 24 | self.img = AsyncImage(source=gifFilename[self.gifindexnow],anim_delay=30/1000) 25 | 26 | layout.add_widget(self.lab) 27 | layout.add_widget(self.img) 28 | 29 | Window.bind(on_key_up=self.key_action) 30 | 31 | return layout 32 | def key_action(self,*args): 33 | ## print ("got a key event: %s" % list(args)) 34 | ## print (args[1],Keyboard().keycode_to_string(args[1])) 35 | print (self.gifindexnow) 36 | if args[1]==276: 37 | print ("left") 38 | if self.gifindexnow>=1: 39 | self.gifindexnow-=1 40 | self.img.source=gifFilename[self.gifindexnow] 41 | else: 42 | self.gifindexnow=giflistlen-1 43 | self.img.source=gifFilename[self.gifindexnow] 44 | elif args[1]==275: 45 | print ("right") 46 | if self.gifindexnow<=(giflistlen-2): 47 | self.gifindexnow+=1 48 | self.img.source=gifFilename[self.gifindexnow] 49 | else: 50 | self.gifindexnow=0 51 | self.img.source=gifFilename[self.gifindexnow] 52 | self.lab.text=gifFilename[self.gifindexnow] 53 | print (self.gifindexnow) 54 | 55 | 56 | TestApp().run() 57 | 58 | -------------------------------------------------------------------------------- /kivy_KeyboardEvent/Kivy-Keyboard-unbind.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.label import Label 4 | from kivy.uix.image import Image, AsyncImage 5 | ##from kivy.core.window import Keyboard 6 | from kivy.core.window import Window 7 | 8 | # keycode 9 | # https://kivy.org/docs/_modules/kivy/core/window.html 10 | 11 | 12 | gifFilename=[".\\Gif2.gif",".\\Gif3.gif",".\\Gif4.gif"] 13 | giflistlen=len(gifFilename) 14 | 15 | 16 | class TestApp(App): 17 | def build(self): 18 | self.title="Kivy Logo" 19 | self.gifindexnow=0 20 | 21 | layout = GridLayout(cols=1) 22 | self.lab = Label(text=gifFilename[self.gifindexnow],markup=True, 23 | font_size='30sp',size_hint_y=None, height=100) 24 | self.img = AsyncImage(source=gifFilename[self.gifindexnow],anim_delay=30/1000) 25 | 26 | layout.add_widget(self.lab) 27 | layout.add_widget(self.img) 28 | self.window=Window 29 | self.window.bind(on_key_up=self.key_action) 30 | 31 | return layout 32 | def key_action(self,*args): 33 | #print ("got a key event: %s" % list(args)) 34 | ## print (args[1],Keyboard().keycode_to_string(args[1])) 35 | #print (self.gifindexnow) 36 | if args[1]==276: 37 | print ("left") 38 | if self.gifindexnow>=1: 39 | self.gifindexnow-=1 40 | self.img.source=gifFilename[self.gifindexnow] 41 | else: 42 | self.gifindexnow=giflistlen-1 43 | self.img.source=gifFilename[self.gifindexnow] 44 | elif args[1]==275: 45 | print ("right") 46 | if self.gifindexnow<=(giflistlen-2): 47 | self.gifindexnow+=1 48 | self.img.source=gifFilename[self.gifindexnow] 49 | else: 50 | self.gifindexnow=0 51 | self.img.source=gifFilename[self.gifindexnow] 52 | elif args[1]==274: 53 | print ('down') 54 | Window.unbind(on_key_up=self.key_action) 55 | Window.bind(on_key_up=self.key_none) 56 | self.lab.text=gifFilename[self.gifindexnow] 57 | ## print (self.gifindexnow) 58 | def key_none(self,*args): 59 | print("here "+str(args[1])) 60 | 61 | rootApp=TestApp() 62 | rootApp.run() 63 | 64 | -------------------------------------------------------------------------------- /ImageProcessing/People Density/PeopleGMMExample20180326.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | close all 4 | 5 | % train a foreground detector 6 | foregroundDetector = vision.ForegroundDetector('NumGaussians',5,... 7 | 'NumTrainingFrames', 30); 8 | videoReader = vision.VideoFileReader('people.avi'); 9 | 10 | for i = 1:100 11 | frame = step(videoReader); % read the next video frame 12 | foreground = step(foregroundDetector, frame); 13 | end 14 | figure; 15 | subplot(3,1,1);imshow(frame); title('Video Frame'); 16 | subplot(3,1,2);imshow(foreground); title('Foreground'); 17 | 18 | % clean the foreground 19 | se = strel('disk', 1); 20 | filteredForeground = imopen(foreground, se); 21 | subplot(3,1,3); imshow(filteredForeground); title('Clean Foreground'); 22 | 23 | % get foreground region objects(FROs) 24 | s = regionprops(filteredForeground,'BoundingBox','Area','Centroid'); 25 | bbox = cat(1, s.BoundingBox); 26 | area=cat(1,s.Area); 27 | centroid=cat(1,s.Centroid); 28 | 29 | % filter the FROs with area property 30 | Area=area>5&area<200; 31 | bbox=bbox(Area,:); 32 | centroid=centroid(Area,:); 33 | 34 | % hierarchical clustering 35 | Y = pdist(centroid); 36 | Z = linkage(Y); 37 | figure;dendrogram(Z,200);title('Dentrogram') 38 | I = inconsistent(Z); 39 | threshold=mean(Z(:,3))+std(Z(:,3),1) 40 | T = cluster(Z,'cutoff',threshold,'criterion','distance'); 41 | Tcen=min(T):1:max(T); 42 | Thist=hist(T,Tcen); 43 | [v,c]=sort(Thist,'descend'); 44 | 45 | % extract top3 clusters 46 | T1=bbox(T==c(1),:); 47 | T2=bbox(T==c(2),:); 48 | T3=bbox(T==c(3),:); 49 | 50 | % get merged bounding box 51 | box1=getBox(T1); 52 | box2=getBox(T2); 53 | box3=getBox(T3); 54 | 55 | % plot the results 56 | result = insertShape(frame, 'Rectangle',T1 , 'Color', 'red'); 57 | result = insertShape(result, 'Rectangle', box1,'LineWidth',2, 'Color', 'red'); 58 | result = insertShape(result, 'Rectangle', T2, 'Color', 'green'); 59 | result = insertShape(result, 'Rectangle', box2,'LineWidth',2, 'Color', 'green'); 60 | result = insertShape(result, 'Rectangle', T3, 'Color', 'blue'); 61 | result = insertShape(result, 'Rectangle', box3,'LineWidth',2, 'Color', 'blue'); 62 | numCars = size(bbox, 1); 63 | result = insertText(result, [10 10], numCars, 'BoxOpacity', 1, 'FontSize', 14); 64 | figure; imshow(result); title('Detected People'); 65 | 66 | % function to get merged bounding box 67 | function box=getBox(box1) 68 | box=[min(box1(:,1)) min(box1(:,2)) ... 69 | max(box1(:,1)+box1(:,3))-min(box1(:,1))... 70 | max(box1(:,2)+box1(:,4))-min(box1(:,2))]; 71 | end -------------------------------------------------------------------------------- /Kivy/RGB2Gray/RGB2Gray.py: -------------------------------------------------------------------------------- 1 | import matplotlib 2 | matplotlib.use('module://kivy.garden.matplotlib.backend_kivy') 3 | import matplotlib.pyplot as plt 4 | 5 | from PIL import Image 6 | import numpy as np 7 | 8 | from kivy.garden.matplotlib.backend_kivyagg import FigureCanvas,FigureCanvasKivyAgg 9 | 10 | from kivy.app import App 11 | from kivy.uix.gridlayout import GridLayout 12 | from kivy.uix.button import Button 13 | from kivy.uix.label import Label 14 | 15 | from kivy.uix.floatlayout import FloatLayout 16 | from kivy.factory import Factory 17 | from kivy.properties import ObjectProperty 18 | from kivy.uix.popup import Popup 19 | import os 20 | 21 | fig,ax=plt.subplots() 22 | fig2,ax2=plt.subplots() 23 | 24 | 25 | class LoadDialog(FloatLayout): 26 | load = ObjectProperty(None) 27 | cancel = ObjectProperty(None) 28 | cwdir=ObjectProperty(None) 29 | 30 | class MyApp(App): 31 | 32 | 33 | def build(self): 34 | self.title='RGB to Grayscale' 35 | box = GridLayout(cols=2) 36 | 37 | label1=Label(text='[b][color=ff0000]R[/color][color=00ff00]G[/color][color=0000ff]B[/color] image[/b]', 38 | font_size='20sp',size_hint_y=None, height=50,markup=True) 39 | label2=Label(text='[b]Grayscale image[/b]', 40 | font_size='20sp',size_hint_y=None, height=50,markup=True) 41 | 42 | box.add_widget(label1) 43 | box.add_widget(label2) 44 | 45 | box.add_widget(FigureCanvasKivyAgg(fig)) 46 | box.add_widget(FigureCanvasKivyAgg(fig2)) 47 | 48 | openBtn=Button(text='Open',size_hint_y=None, height=50) 49 | openBtn.bind(on_release=self.show_load) 50 | box.add_widget(openBtn) 51 | 52 | grayBtn=Button(text='RGB2Gray',size_hint_y=None, height=50) 53 | grayBtn.bind(on_release=self.gray_image) 54 | box.add_widget(grayBtn) 55 | 56 | self.imgG=None 57 | return box 58 | 59 | 60 | 61 | def show_load(self,obj): 62 | content = LoadDialog(load=self.load, cancel=self.dismiss_popup,cwdir=os.getcwd()) 63 | self._popup = Popup(title="Load file", content=content,size_hint=(0.9, 0.9)) 64 | self._popup.open() 65 | 66 | def load(self, path, filename): 67 | if filename: 68 | img=Image.open(os.path.join(path, filename[0])) 69 | ax.imshow(np.array(img)) 70 | fig.canvas.draw() 71 | self.dismiss_popup() 72 | self.imgG=img 73 | 74 | def dismiss_popup(self): 75 | self._popup.dismiss() 76 | 77 | def gray_image(self,obj): 78 | if self.imgG!=None: 79 | img=self.imgG.convert("L") 80 | ax2.imshow(np.array(img),cmap="gray") 81 | fig2.canvas.draw() 82 | 83 | Factory.register('LoadDialog', cls=LoadDialog) 84 | MyApp().run() 85 | -------------------------------------------------------------------------------- /SevenDayRank/SevenDayRank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 29 | 30 | 31 |
32 |
33 |
34 | 35 |
36 |
37 |

38 | 代码君CodeSama 开播第27天了,(*^▽^*) 39 |

40 |
41 |

直播进度 (晚上8点左右开播,11点半下播):

42 |
43 |
0%
45 |
46 |
47 | 48 |
49 |
50 | 90 | 91 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /KivyGifSlide/Kivy-Gif-slide.py: -------------------------------------------------------------------------------- 1 | from kivy.app import App 2 | from kivy.uix.gridlayout import GridLayout 3 | from kivy.uix.label import Label 4 | from kivy.uix.image import Image, AsyncImage 5 | import PIL 6 | 7 | gifFilename=['.\\Gif2.gif','.\\Gif3.gif','.\\Gif4.gif','.\\Gif0.gif'] 8 | 9 | class MyAsyncImage(AsyncImage): 10 | 11 | def __init__(self,**args): 12 | self.filelist=args['filelist'] 13 | self.fnumberlist=list() 14 | self.animeDelay=list() 15 | for i in range(0,len(self.filelist)): 16 | self.fnumberlist.append(self.getFrameNumber(self.filelist[i])) 17 | self.animeDelay.append(self.getAnimeDelay(self.filelist[i])) 18 | # frame counter for a single gif file 19 | self.frame_counter=0 20 | self.frame_number=self.fnumberlist[0] 21 | # imagelist index 22 | self.img_pointer=0 23 | # image file handle 24 | self.imgloading=None 25 | # flag:one file have been loaded 26 | self.loadingEnd=False 27 | # flag:all files have been loaded 28 | self.loadingloop=False 29 | 30 | AsyncImage.__init__(self,source=self.filelist[0],anim_delay=self.animeDelay[0]) 31 | 32 | def on_texture(self, instance, value): 33 | if not self.loadingEnd: 34 | if self.frame_counter==0: 35 | self.imgloading=self._coreimage.image 36 | self.frame_counter += 1 37 | else: 38 | if self._coreimage.image!=self.imgloading: 39 | self.loadingEnd=True 40 | self.frame_counter=0 41 | else: 42 | self.frame_counter += 1 43 | else: 44 | if self.frame_counter == (self.frame_number-1): 45 | if self.img_pointer<(len(self.filelist)-1): 46 | self.img_pointer+=1 47 | else: 48 | self.img_pointer=0 49 | self.loadingloop=True 50 | 51 | if self.loadingloop==False: 52 | self.loadingEnd=False 53 | 54 | self.on_changefile() 55 | 56 | else: 57 | self.frame_counter += 1 58 | 59 | def on_changefile(self): 60 | self.frame_counter=0 61 | self.frame_number=self.fnumberlist[self.img_pointer] 62 | self.anim_delay=self.animeDelay[self.img_pointer] 63 | self.source=self.filelist[self.img_pointer] 64 | 65 | def getFrameNumber(self,filename): 66 | img=PIL.Image.open(filename) 67 | counter=0 68 | try: 69 | while(True): 70 | img.seek(img.tell()+1) 71 | counter+=1 72 | except EOFError: 73 | if counter==0: 74 | return 1 75 | else: 76 | return counter 77 | 78 | def getAnimeDelay(self,filename): 79 | return PIL.Image.open(filename).info['duration']/1000.0 80 | 81 | class TestApp(App): 82 | def build(self): 83 | self.title="Kivy Gif Slide" 84 | layout = GridLayout(cols=1) 85 | label=Label(text="Kivy Gif Slide",font_size='30sp',size_hint_y=None, height=100) 86 | layout.add_widget(label) 87 | images = MyAsyncImage(filelist=gifFilename) 88 | layout.add_widget(images) 89 | return layout 90 | 91 | TestApp().run() 92 | 93 | -------------------------------------------------------------------------------- /MATLAB/GUI/RGB2Gray/RBG2Gray.m: -------------------------------------------------------------------------------- 1 | function varargout = RBG2Gray(varargin) 2 | % RBG2GRAY MATLAB code for RBG2Gray.fig 3 | % RBG2GRAY, by itself, creates a new RBG2GRAY or raises the existing 4 | % singleton*. 5 | % 6 | % H = RBG2GRAY returns the handle to a new RBG2GRAY or the handle to 7 | % the existing singleton*. 8 | % 9 | % RBG2GRAY('CALLBACK',hObject,eventData,handles,...) calls the local 10 | % function named CALLBACK in RBG2GRAY.M with the given input arguments. 11 | % 12 | % RBG2GRAY('Property','Value',...) creates a new RBG2GRAY or raises the 13 | % existing singleton*. Starting from the left, property value pairs are 14 | % applied to the GUI before RBG2Gray_OpeningFcn gets called. An 15 | % unrecognized property name or invalid value makes property application 16 | % stop. All inputs are passed to RBG2Gray_OpeningFcn via varargin. 17 | % 18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19 | % instance to run (singleton)". 20 | % 21 | % See also: GUIDE, GUIDATA, GUIHANDLES 22 | 23 | % Edit the above text to modify the response to help RBG2Gray 24 | 25 | % Last Modified by GUIDE v2.5 20-Mar-2018 11:06:06 26 | 27 | % Begin initialization code - DO NOT EDIT 28 | gui_Singleton = 1; 29 | gui_State = struct('gui_Name', mfilename, ... 30 | 'gui_Singleton', gui_Singleton, ... 31 | 'gui_OpeningFcn', @RBG2Gray_OpeningFcn, ... 32 | 'gui_OutputFcn', @RBG2Gray_OutputFcn, ... 33 | 'gui_LayoutFcn', [] , ... 34 | 'gui_Callback', []); 35 | if nargin && ischar(varargin{1}) 36 | gui_State.gui_Callback = str2func(varargin{1}); 37 | end 38 | 39 | if nargout 40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41 | else 42 | gui_mainfcn(gui_State, varargin{:}); 43 | end 44 | % End initialization code - DO NOT EDIT 45 | 46 | 47 | % --- Executes just before RBG2Gray is made visible. 48 | function RBG2Gray_OpeningFcn(hObject, eventdata, handles, varargin) 49 | % This function has no output args, see OutputFcn. 50 | % hObject handle to figure 51 | % eventdata reserved - to be defined in a future version of MATLAB 52 | % handles structure with handles and user data (see GUIDATA) 53 | % varargin command line arguments to RBG2Gray (see VARARGIN) 54 | 55 | % Choose default command line output for RBG2Gray 56 | handles.output = hObject; 57 | handles.imgfilename=[]; 58 | handles.imgdata=[]; 59 | handles.imgoutput=[]; 60 | % Update handles structure 61 | guidata(hObject, handles); 62 | 63 | % UIWAIT makes RBG2Gray wait for user response (see UIRESUME) 64 | % uiwait(handles.figure1); 65 | 66 | 67 | % --- Outputs from this function are returned to the command line. 68 | function varargout = RBG2Gray_OutputFcn(hObject, eventdata, handles) 69 | % varargout cell array for returning output args (see VARARGOUT); 70 | % hObject handle to figure 71 | % eventdata reserved - to be defined in a future version of MATLAB 72 | % handles structure with handles and user data (see GUIDATA) 73 | 74 | % Get default command line output from handles structure 75 | varargout{1} = handles.output; 76 | 77 | 78 | % --- Executes on button press in pushbutton1. 79 | function pushbutton1_Callback(hObject, eventdata, handles) 80 | % hObject handle to pushbutton1 (see GCBO) 81 | % eventdata reserved - to be defined in a future version of MATLAB 82 | % handles structure with handles and user data (see GUIDATA) 83 | [imgfilename imgpathname]=uigetfile({'*.jpg;*.png'},'Select a RGB image'); 84 | if imgfilename 85 | imgdata=imread([imgpathname '\' imgfilename]); 86 | image(handles.axes1,imgdata); 87 | handles.imgfilename=imgfilename; 88 | handles.imgdata=imgdata; 89 | end 90 | guidata(hObject,handles) 91 | 92 | 93 | % --- Executes on button press in pushbutton2. 94 | function pushbutton2_Callback(hObject, eventdata, handles) 95 | % hObject handle to pushbutton2 (see GCBO) 96 | % eventdata reserved - to be defined in a future version of MATLAB 97 | % handles structure with handles and user data (see GUIDATA) 98 | if ~isempty(handles.imgfilename) 99 | imgoutput=rgb2gray(handles.imgdata); 100 | image(handles.axes2,imgoutput) 101 | colormap(handles.axes2,gray(256)) 102 | handles.imgoutput=imgoutput; 103 | end 104 | 105 | guidata(hObject,handles) -------------------------------------------------------------------------------- /wordcloud/worldcloudCodeSamaLogo20180402.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /wordcloud/worldcloudCodeSamaLogo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /SevenDayRankPython/SevenDayRankUpdate.py: -------------------------------------------------------------------------------- 1 | #coding:utf-8 2 | 3 | import urlfetch 4 | import json 5 | import time 6 | commentstr=''' 7 | 23010532,山里一泼猴,Bilibili同桌,B站直播UP 8 | 5724886,隔壁街老王,经常串门的大佬,绿了一条街233 9 | 123870078,ChYFx_Christer,C#大佬,游戏视频UP 10 | 13726234,MrChinico,经常⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄的大佬,约好做同桌 11 | 18107647,这里有蜘蛛°,给予鼓励的大佬,大佬头像很好看 12 | 5271069,盒饭工作室,B站直播UP,高考加油 13 | 20237217,SuperPaxxs,对直播撸码很惊讶的大佬,B站up 14 | 95113356,小火车车车,直播来了一次的大佬,后面就没见到了 15 | 24313542,B站人工机器人,第一个投喂亿元的大佬,给大佬拜年了 16 | ''' 17 | 18 | htmlcard1=''' 19 |
20 |

#Uname#

21 | #Uname# 22 |
23 |

#Comments#

24 |

#Details#

25 |
26 |
27 | ''' 28 | htmlcard2=''' 29 |
30 | #Uname# 31 |
32 |

#Uname#

33 |

#Comments#

34 |
35 |
36 | ''' 37 | def getMyInfo(): 38 | hdr={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36', 39 | 'Host':'space.bilibili.com','Origin':'https://space.bilibili.com','Referer':'https://space.bilibili.com/9579763/'} 40 | url='https://space.bilibili.com/ajax/member/GetInfo' 41 | dat={'mid':'9579763'} 42 | res=urlfetch.post(url,headers=hdr,data=dat) 43 | if res.status==200: 44 | resstr=res.content 45 | #print resstr 46 | strjson=json.loads(resstr) 47 | return strjson 48 | else: 49 | return [] 50 | def getSevenDayRank(): 51 | hdr={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36','Host':'api.live.bilibili.com'} 52 | url='https://api.live.bilibili.com/rankdb/v1/RoomRank/webSevenRank?roomid=346623&ruid=9579763' 53 | res=urlfetch.fetch(url,headers=hdr) 54 | if res.status==200: 55 | resstr=res.content 56 | strjson=json.loads(resstr) 57 | return strjson['data']['list'] 58 | else: 59 | return [] 60 | def cardS1(rank,sevenrank,htmlcard1,comment1): 61 | card1=htmlcard1 62 | card1=card1.replace('#Uname#',sevenrank[rank]['uname']) 63 | card1=card1.replace('#face#',sevenrank[rank]['face']) 64 | card1=card1.replace('#DalaoOrder#','dalao'+str(rank+1)) 65 | ## #print sevenrank[rank]['uname'].encode('utf-8') 66 | ## #print comment[str(sevenrank[rank]['uid'])][2].decode('utf-8') 67 | ## print (comment1[str(sevenrank[rank]['uid'])][1]) 68 | ## print (comment1[str(sevenrank[rank]['uid'])][2]) 69 | if (str(sevenrank[rank]['uid'])) in comment1: 70 | card1=card1.replace('#Comments#',comment1[str(sevenrank[rank]['uid'])][1]) 71 | card1=card1.replace('#Details#',comment1[str(sevenrank[rank]['uid'])][2]) 72 | return card1 73 | def cardS2(rank,sevenrank,htmlcard1,active,comment1): 74 | card1=htmlcard2 75 | card1=card1.replace('#Uname#',sevenrank[rank]['uname']) 76 | card1=card1.replace('#face#',sevenrank[rank]['face']) 77 | if (str(sevenrank[rank]['uid'])) in comment1: 78 | card1=card1.replace('#Comments#',comment1[str(sevenrank[rank]['uid'])][1]) 79 | 80 | if active: 81 | card1=card1.replace('#active#','active') 82 | else: 83 | card1=card1.replace('#active#','') 84 | return card1 85 | def commentParser(commentstr): 86 | ## fid=open('comment.txt','rb') 87 | ## fstr=fid.read().decode(encoding="utf-8") 88 | ## fid.close() 89 | 90 | comment1=dict() 91 | #details=list() 92 | flist=commentstr.strip().split('\n') 93 | ## flist=fstr.strip().split('\r\n') 94 | for single in flist: 95 | slist=single.split(',') 96 | print (slist) 97 | comment1[slist[0]]=[slist[1],slist[2],slist[3]]; 98 | #print comment[slist[0]][0] 99 | return comment1 100 | 101 | 102 | #print str(getSevenDayRank()) 103 | sevenrank=getSevenDayRank() 104 | #print result[0]['uname'] 105 | comment1=commentParser(commentstr.decode('utf-8')) 106 | 107 | section1="" 108 | section1=section1+cardS1(0,sevenrank,htmlcard1,comment1) 109 | section1=section1+cardS1(1,sevenrank,htmlcard1,comment1) 110 | section1=section1+cardS1(2,sevenrank,htmlcard1,comment1) 111 | 112 | section2="" 113 | section2=section2+cardS2(3,sevenrank,htmlcard2,True,comment1) 114 | for i in range(4,len(sevenrank)): 115 | section2=section2+cardS2(i,sevenrank,htmlcard2,False,comment1) 116 | 117 | #print section1 118 | #print section2 119 | myInfo=getMyInfo(); 120 | fid=open('SevenDayRankTemplate.html','rb') 121 | fstr=fid.read() 122 | fid.close() 123 | fstr=fstr.decode(encoding="utf-8") 124 | fstr=fstr.replace("#Section1#",section1) 125 | fstr=fstr.replace("#Section2#",section2) 126 | fstr=fstr.replace('#ownface#',myInfo['data']['face']) 127 | filename='SevenDayRank'+time.strftime("%Y%m%d",time.localtime())+'.html' 128 | fid=open(filename,'wb') 129 | fid.write(fstr.encode(encoding="utf-8")) 130 | fid.close() 131 | 132 | 133 | -------------------------------------------------------------------------------- /SevenDayRankPython/SevenDayRankTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 38 | 39 | 40 | 41 |
42 |
43 |
44 | 45 |
46 |
47 |

48 | 代码君CodeSama 开播第27天了,(*^▽^*) 49 |

50 |
51 |

直播进度 (晚上8点左右开播,11点半下播):

52 |
53 |
0%
55 |
56 |
57 | 58 |
59 | 60 | 100 |
101 |
102 | 103 | 104 |
105 | 110 |
111 |
112 |

Up去核电水~

113 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

114 |
115 |
116 |

今天就到这儿啦~字符云制作的视频已经投递了,大家可以看一下

117 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

118 |
119 |
120 |

昨天投了Echarts制作字符云的视频,大家有空可以去看看

121 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

122 |
123 |
124 |
125 | 126 | 127 |
128 |

感谢大佬们的小礼物:

129 |
130 |
131 | #Section1# 132 |
133 |

投喂过的大佬:

134 | 139 |
140 | 141 |
142 |
143 |
144 | 145 | 146 | -------------------------------------------------------------------------------- /MATLAB/GUI/SoundRecorder/SoundRecorderDemo.m: -------------------------------------------------------------------------------- 1 | function varargout = SoundRecorderDemo(varargin) 2 | % SOUNDRECORDERDEMO MATLAB code for SoundRecorderDemo.fig 3 | % SOUNDRECORDERDEMO, by itself, creates a new SOUNDRECORDERDEMO or raises the existing 4 | % singleton*. 5 | % 6 | % H = SOUNDRECORDERDEMO returns the handle to a new SOUNDRECORDERDEMO or the handle to 7 | % the existing singleton*. 8 | % 9 | % SOUNDRECORDERDEMO('CALLBACK',hObject,eventData,handles,...) calls the local 10 | % function named CALLBACK in SOUNDRECORDERDEMO.M with the given input arguments. 11 | % 12 | % SOUNDRECORDERDEMO('Property','Value',...) creates a new SOUNDRECORDERDEMO or raises the 13 | % existing singleton*. Starting from the left, property value pairs are 14 | % applied to the GUI before SoundRecorderDemo_OpeningFcn gets called. An 15 | % unrecognized property name or invalid value makes property application 16 | % stop. All inputs are passed to SoundRecorderDemo_OpeningFcn via varargin. 17 | % 18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19 | % instance to run (singleton)". 20 | % 21 | % See also: GUIDE, GUIDATA, GUIHANDLES 22 | 23 | % Edit the above text to modify the response to help SoundRecorderDemo 24 | 25 | % Last Modified by GUIDE v2.5 10-Apr-2018 14:18:34 26 | 27 | % Begin initialization code - DO NOT EDIT 28 | gui_Singleton = 1; 29 | gui_State = struct('gui_Name', mfilename, ... 30 | 'gui_Singleton', gui_Singleton, ... 31 | 'gui_OpeningFcn', @SoundRecorderDemo_OpeningFcn, ... 32 | 'gui_OutputFcn', @SoundRecorderDemo_OutputFcn, ... 33 | 'gui_LayoutFcn', [] , ... 34 | 'gui_Callback', []); 35 | if nargin && ischar(varargin{1}) 36 | gui_State.gui_Callback = str2func(varargin{1}); 37 | end 38 | 39 | if nargout 40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41 | else 42 | gui_mainfcn(gui_State, varargin{:}); 43 | end 44 | % End initialization code - DO NOT EDIT 45 | 46 | 47 | % --- Executes just before SoundRecorderDemo is made visible. 48 | function SoundRecorderDemo_OpeningFcn(hObject, eventdata, handles, varargin) 49 | % This function has no output args, see OutputFcn. 50 | % hObject handle to figure 51 | % eventdata reserved - to be defined in a future version of MATLAB 52 | % handles structure with handles and user data (see GUIDATA) 53 | % varargin command line arguments to SoundRecorderDemo (see VARARGIN) 54 | 55 | % Choose default command line output for SoundRecorderDemo 56 | handles.output = hObject; 57 | handles.recObj = audiorecorder(48000, 16, 2,-1); 58 | handles.recObj.TimerFcn={@RecDisplay,handles}; 59 | handles.recObj.TimerPeriod=0.25; 60 | handles.playSpeed=1; 61 | % Update handles structure 62 | guidata(hObject, handles); 63 | 64 | % UIWAIT makes SoundRecorderDemo wait for user response (see UIRESUME) 65 | % uiwait(handles.figure1); 66 | 67 | 68 | % --- Outputs from this function are returned to the command line. 69 | function varargout = SoundRecorderDemo_OutputFcn(hObject, eventdata, handles) 70 | % varargout cell array for returning output args (see VARARGOUT); 71 | % hObject handle to figure 72 | % eventdata reserved - to be defined in a future version of MATLAB 73 | % handles structure with handles and user data (see GUIDATA) 74 | 75 | % Get default command line output from handles structure 76 | varargout{1} = handles.output; 77 | 78 | 79 | % --- Executes on button press in pushbutton1. 80 | function pushbutton1_Callback(hObject, eventdata, handles) 81 | % hObject handle to pushbutton1 (see GCBO) 82 | % eventdata reserved - to be defined in a future version of MATLAB 83 | % handles structure with handles and user data (see GUIDATA) 84 | 85 | record(handles.recObj); 86 | 87 | % --- Executes on button press in pushbutton2. 88 | function pushbutton2_Callback(hObject, eventdata, handles) 89 | % hObject handle to pushbutton2 (see GCBO) 90 | % eventdata reserved - to be defined in a future version of MATLAB 91 | % handles structure with handles and user data (see GUIDATA) 92 | stop(handles.recObj) 93 | 94 | % --- Executes on button press in pushbutton3. 95 | function pushbutton3_Callback(hObject, eventdata, handles) 96 | % hObject handle to pushbutton3 (see GCBO) 97 | % eventdata reserved - to be defined in a future version of MATLAB 98 | % handles structure with handles and user data (see GUIDATA) 99 | handles.myRecording = getaudiodata(handles.recObj); 100 | handles.playObj = audioplayer(handles.myRecording,handles.playSpeed*handles.recObj.SampleRate); 101 | play(handles.playObj); 102 | guidata(hObject, handles); 103 | 104 | % --- Executes on button press in pushbutton4. 105 | function pushbutton4_Callback(hObject, eventdata, handles) 106 | % hObject handle to pushbutton4 (see GCBO) 107 | % eventdata reserved - to be defined in a future version of MATLAB 108 | % handles structure with handles and user data (see GUIDATA) 109 | [file,path] = uiputfile(['soundDemo_Speed' num2str(handles.playSpeed) '.wav'],'Save recorded sound'); 110 | if file 111 | audiowrite([path '\' file],handles.myRecording,handles.playSpeed*handles.recObj.SampleRate) 112 | end 113 | 114 | function RecDisplay(hObject, eventdata,handles) 115 | %handles 116 | handles.myRecording = getaudiodata(handles.recObj); 117 | % axes(handles.axes1) 118 | plot(handles.axes1,(1:length(handles.myRecording))/handles.recObj.SampleRate,handles.myRecording) 119 | drawnow; 120 | 121 | 122 | 123 | function edit1_Callback(hObject, eventdata, handles) 124 | % hObject handle to edit1 (see GCBO) 125 | % eventdata reserved - to be defined in a future version of MATLAB 126 | % handles structure with handles and user data (see GUIDATA) 127 | 128 | % Hints: get(hObject,'String') returns contents of edit1 as text 129 | % str2double(get(hObject,'String')) returns contents of edit1 as a double 130 | handles.playSpeed=str2double(get(hObject,'String')); 131 | guidata(hObject,handles) 132 | 133 | % --- Executes during object creation, after setting all properties. 134 | function edit1_CreateFcn(hObject, eventdata, handles) 135 | % hObject handle to edit1 (see GCBO) 136 | % eventdata reserved - to be defined in a future version of MATLAB 137 | % handles empty - handles not created until after all CreateFcns called 138 | 139 | % Hint: edit controls usually have a white background on Windows. 140 | % See ISPC and COMPUTER. 141 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 142 | set(hObject,'BackgroundColor','white'); 143 | end 144 | -------------------------------------------------------------------------------- /ParticleWebMouse/ParticleWeb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 220 | 221 | -------------------------------------------------------------------------------- /SevenDayRank/SevenDayRank2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 37 | 38 | 39 |
40 |
41 |
42 | 43 |
44 |
45 |

46 | 代码君CodeSama 开播第27天了,(*^▽^*) 47 |

48 |
49 |

直播进度 (晚上8点左右开播,11点半下播):

50 |
51 |
0%
53 |
54 |
55 | 56 |
57 |
58 | 98 | 99 |
100 | 101 |
102 | 107 |
108 |
109 |

Up去核电水~

110 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

111 |
112 |
113 |

今天就到这儿啦~去刷牙了

114 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

115 |
116 |
117 |

今天投了Echarts制作字符云的视频,大家有空可以去看看

118 |

大佬们请点“关注”mark一下,或者投根辣条,谢谢~

119 |
120 |
121 |
122 |
123 |

感谢大佬们的小礼物:

124 |
125 |
126 |
127 |

山里一泼猴

128 | 大佬头像 129 |
130 |

Bilibili同桌

131 |

正在直播

132 |
133 |
134 |
135 |

隔壁街老王

136 | 大佬头像 137 |
138 |

经常串门的大佬

139 |

绿了一条街,233

140 |
141 |
142 |
143 |

MrChinico

144 | 大佬头像 145 |
146 |

经常⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄的大佬

147 |

监督学习,超严厉的

148 |
149 |
150 |
151 |

投喂过的大佬:

152 | 184 |
185 |
186 |
187 |
188 | 189 | 190 | -------------------------------------------------------------------------------- /ParticleWebMouse/ParticleWebMouse-large.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 |
20 | 21 |
22 | 287 | 288 | -------------------------------------------------------------------------------- /Kivy/Game-Snake/KivySnake20180408.py: -------------------------------------------------------------------------------- 1 | import random 2 | import json 3 | import urlfetch 4 | from kivy.graphics import * 5 | from kivy.app import App 6 | from kivy.uix.widget import Widget 7 | from kivy.uix.floatlayout import FloatLayout 8 | from kivy.uix.gridlayout import GridLayout 9 | from kivy.uix.label import Label 10 | from kivy.core.window import Window 11 | from kivy.uix.image import AsyncImage 12 | from kivy.clock import Clock 13 | 14 | # to get url of CodeSama's logo 15 | def getMyInfo(): 16 | hdr={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36', 17 | 'Host':'space.bilibili.com','Origin':'https://space.bilibili.com','Referer':'https://space.bilibili.com/9579763/'} 18 | url='https://space.bilibili.com/ajax/member/GetInfo' 19 | dat={'mid':'9579763'} 20 | res=urlfetch.post(url,headers=hdr,data=dat) 21 | if res.status==200: 22 | resstr=res.content 23 | #print resstr 24 | strjson=json.loads(resstr) 25 | return strjson['data'] 26 | else: 27 | return [] 28 | 29 | # to get follower's logo 30 | def getSevenDayRank(): 31 | hdr={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36','Host':'api.live.bilibili.com'} 32 | url='https://api.live.bilibili.com/rankdb/v1/RoomRank/webSevenRank?roomid=346623&ruid=9579763' 33 | res=urlfetch.fetch(url,headers=hdr) 34 | if res.status==200: 35 | resstr=res.content 36 | #print (resstr) 37 | strjson=json.loads(resstr) 38 | return strjson['data']['list'] 39 | else: 40 | return [] 41 | 42 | # testing images 43 | '''applefaceUrl=['https://i1.hdslb.com/bfs/face/76f04dc6622ab95b5ff5044660ef9b2d2e0e9adf.jpg','https://i2.hdslb.com/bfs/face/5418b6517e83b0175adf4df4d85cdb8fb4096019.jpg', 44 | 'https://i2.hdslb.com/bfs/face/cd7541d9cf9ffcd6d32ada14470a9d35b4e24f4d.jpg','https://i2.hdslb.com/bfs/face/25f28666da932d856d0f510f406a00e5206966fe.jpg' 45 | ]''' 46 | #loading logo of codesama 47 | codesama=getMyInfo() 48 | snakeface=AsyncImage(source=codesama['face']) 49 | 50 | # laoding logos of followers 51 | applefaceUrl=list() 52 | sRank=getSevenDayRank() 53 | for single in sRank: 54 | applefaceUrl.append(single['face']) 55 | applefacelist=list() 56 | for i in range(0,len(applefaceUrl)): 57 | applefacelist.append(AsyncImage(source=applefaceUrl[i])) 58 | 59 | # background: chessboard 60 | class self_bg(Widget): 61 | def __init__(self): 62 | Widget.__init__(self,size=(600,600),size_hint=(None, None)) 63 | with self.canvas: 64 | for j in range(0,10): 65 | flag=j % 2 66 | for i in range(0,10): 67 | if i % 2==flag: 68 | Color(111/255.0, 159/255.0, 216/255.0) 69 | Rectangle(pos=(60*i,60*j),size=(60,60)) 70 | else: 71 | Color(175/255.0, 201/255.0, 233/255.0) 72 | Rectangle(pos=(60*i,60*j),size=(60,60)) 73 | 74 | # snake head: automove interval 1s 75 | class self_snake_head(Widget): 76 | def __init__(self,filename,position): 77 | Widget.__init__(self, 78 | size=(60,60),pos=position) 79 | self.filename=filename 80 | self.Endflag=False 81 | Clock.schedule_interval(self.clockCallback, 1) 82 | with self.canvas: 83 | Color(0,1,0,0.3) 84 | print (self.pos,self.size) 85 | self.bg_ellipse=Ellipse(pos=(self.x-5,self.y-5),size=(self.width+10,self.height+10), 86 | angle_start=0,angle_end=360) 87 | 88 | Color(1,1,1,1) 89 | self.bg_logo=Ellipse(pos=(self.x+3,self.y+3),size=(self.width-6,self.height-6), 90 | angle_start=0,angle_end=360,texture=filename.texture) 91 | self.bind(pos=self.redraw) 92 | 93 | def redraw(self,instance,value): 94 | self.Endflag=(value[0],value[1]) in rootApp.snakepos 95 | condition2=value[0]>=0 and value[0]<600 and value[1]>=0 and value[1]<600 96 | if condition2 and not self.Endflag: 97 | self.bg_ellipse.pos=(self.x-5,self.y-5) 98 | self.bg_logo.pos=(self.x+3,self.y+3) 99 | self.bg_logo.texture=self.filename.texture 100 | else: 101 | self.Endflag=True 102 | Clock.unschedule(self.clockCallback) 103 | print("Game Over") 104 | def clockCallback(self,dt): 105 | self.pos=(self.x+rootApp.snakeDir[0],self.y+rootApp.snakeDir[1]) 106 | rootApp.snakepos.append((self.x,self.y)) 107 | refresh_snakelist() 108 | 109 | # snake tail 110 | class self_snake_tail(Widget): 111 | def __init__(self,filename,position): 112 | Widget.__init__(self, 113 | size=(60,60),pos=position) 114 | self.filename=filename 115 | self.Endflag=False 116 | with self.canvas: 117 | Color(1,1,1) 118 | print (self.pos,self.size) 119 | self.bg_ellipse=Ellipse(pos=self.pos,size=self.size, 120 | angle_start=0,angle_end=360) 121 | self.bg_logo=Ellipse(pos=(self.x+3,self.y+3),size=(self.width-6,self.height-6), 122 | angle_start=0,angle_end=360,texture=filename.texture) 123 | self.bind(pos=self.redraw) 124 | def redraw(self,instance,value): 125 | self.bg_ellipse.pos=self.pos 126 | self.bg_logo.pos=(self.x+3,self.y+3) 127 | self.bg_logo.texture=self.filename.texture 128 | 129 | # to refresh the number and position of snake tails 130 | def refresh_snakelist(): 131 | if rootApp.snake.x-rootApp.apple.x==0 and rootApp.snake.y-rootApp.apple.y==0: 132 | addsnake=self_snake_tail(applefacelist[rootApp.apple.applefaceindex], 133 | position=(rootApp.snakepos[-(len(rootApp.snakelist)+2)][0],rootApp.snakepos[-(len(rootApp.snakelist)+2)][1])) 134 | rootApp.snakelist.append(addsnake) 135 | rootApp.layout.add_widget(addsnake) 136 | print (len(rootApp.snakelist),-(len(rootApp.snakelist)+2)) 137 | 138 | rootApp.apple.opacity=0 139 | rootApp.apple.appleFlag=True 140 | rootApp.label.text=str(len(rootApp.snakelist)+1) 141 | else: 142 | rootApp.snakepos.pop(0) 143 | for i in range(0,len(rootApp.snakelist)): 144 | rootApp.snakelist[i].pos=(rootApp.snakepos[-(i+2)][0],rootApp.snakepos[-(i+2)][1]) 145 | 146 | # apple at random position, reloading time 3s 147 | class self_apple(Widget): 148 | def __init__(self): 149 | Widget.__init__(self, 150 | size=(60,60),pos=(2*60,2*60)) 151 | self.appleFlag=False 152 | self.applefaceindex=0 153 | Clock.schedule_interval(self.AppleclockCallback,3) 154 | 155 | with self.canvas: 156 | Color(1,0,0,0.5) 157 | print (self.pos,self.size) 158 | self.bg_ellipse=Ellipse(pos=(self.x-5,self.y-5),size=(self.width+10,self.height+10), 159 | angle_start=0,angle_end=360) 160 | Color(1,1,1,1) 161 | self.bg_logo=Ellipse(pos=(self.x+5,self.y+5),size=(self.width-10,self.height-10), 162 | angle_start=0,angle_end=360,texture=applefacelist[0].texture) 163 | 164 | def AppleclockCallback(self,dt): 165 | if self.appleFlag: 166 | applex=random.randint(0, 10-1)*60 167 | appley=random.randint(0, 10-1)*60 168 | applefaceindex=random.randint(0, len(applefacelist)-1) 169 | self.applefaceindex=applefaceindex 170 | appleface=applefacelist[applefaceindex] 171 | self.opacity=1 172 | self.bg_logo.texture=appleface.texture 173 | self.pos=(applex,appley) 174 | self.bg_ellipse.pos=(self.x-5,self.y-5) 175 | self.bg_logo.pos=(self.x+5,self.y+5) 176 | self.appleFlag=False 177 | 178 | # mainframe: add elements and keyboard listener 179 | class TestApp(App): 180 | def build(self): 181 | self.title="Kivy snake" 182 | 183 | layout=self_bg() 184 | self.snake=self_snake_head(filename=snakeface,position=(4*60,4*60)) 185 | layout.add_widget(self.snake) 186 | 187 | self.snakelist=list() 188 | self.snakeDir=[0,0] 189 | self.snakepos=list() 190 | self.snakepos.append((self.snake.x,self.snake.y)) 191 | 192 | self.apple=self_apple() 193 | layout.add_widget(self.apple) 194 | self.layout=layout 195 | 196 | self.keyboard=Window.bind(on_key_down=self.key_action) 197 | 198 | 199 | layoutAll=GridLayout(cols=2) 200 | layoutAll.add_widget(layout) 201 | label=Label(text='1',font_size='40sp') 202 | layoutAll.add_widget(label) 203 | self.label=label 204 | Clock.schedule_once(self.texture_update,5) 205 | return layoutAll 206 | 207 | def key_action(self,*args): 208 | if not self.snake.Endflag: 209 | vel=60 210 | if args[1]==276: 211 | print ("left") 212 | self.snake.x-=vel 213 | self.snakepos.append((self.snake.x,self.snake.y)) 214 | self.snakeDir=[-vel,0] 215 | refresh_snakelist() 216 | elif args[1]==275: 217 | print ("right") 218 | self.snake.x+=vel 219 | self.snakepos.append((self.snake.x,self.snake.y)) 220 | self.snakeDir=[vel,0] 221 | refresh_snakelist() 222 | elif args[1]==274: 223 | print ("down") 224 | self.snake.y-=vel 225 | self.snakepos.append((self.snake.x,self.snake.y)) 226 | self.snakeDir=[0,-vel] 227 | refresh_snakelist() 228 | elif args[1]==273: 229 | print ("up") 230 | self.snake.y+=vel 231 | self.snakepos.append((self.snake.x,self.snake.y)) 232 | self.snakeDir=[0,vel] 233 | refresh_snakelist() 234 | def texture_update(self,dt): 235 | self.snake.bg_logo.texture =snakeface.texture 236 | self.apple.bg_logo.texture =applefacelist[0].texture 237 | 238 | rootApp=TestApp() 239 | rootApp.run() 240 | --------------------------------------------------------------------------------