Skip to content

Instantly share code, notes, and snippets.

Avatar

Liu Wenyuan Dobby233Liu

View GitHub Profile
View bvtest.py
import requests
import json
import random
Back_URL = 'https://api.bilibili.com/x/web-interface/archive/stat?aid='
headers = {
'Cookie': "Replace Me With REAL COOKIE" ,
'Pragma': 'no-cache',
View 피보나치 수 2.java
import java.util.*;
public class Main {
static long[] memo = new long[91];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print(fibo(sc.nextInt()));
}
static long fibo(int n){
if (n<=1) return n;
@fischerbach
fischerbach / README.md
Created Jan 31, 2020 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
View README.md
@xjohjrdy
xjohjrdy / xiaoxiao_tts.py
Last active May 25, 2021
返回的音频没有文件头,所以我随便加的一个文件头,但显示的音频时长有问题。如果播放器不能正常播放,可以使用Chrome播放。
View xiaoxiao_tts.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from ws4py.client.threadedclient import WebSocketClient
import binascii
class WSClient(WebSocketClient):
def __init__(self, url, text, filename):
View good_idea.c
// Executing this code is a really good idea.
// Trust me, no scam, no lie 100% working 2013.
int main(int argc, char *argv[]) {
// Let's create a null pointer... why not
char *good_ptr = (char*)0;
// Editing a null pointer is DEFINITELY a GREAT idea!
*good_ptr = 0x14;
// Of course, we return an error(or do we?)
return -1;
@GoToLoop
GoToLoop / resizeNN.js
Last active Jan 27, 2021 — forked from gncgnc/resizeNN.js
Extends p5.Image to handle nearest neighbor resizing for scaling images w/o blurring.
View resizeNN.js
/**
* Resize the image to a new width and height using nearest neighbor algorithm.
* To make the image scale proportionally, use 0 as the value for the wide or high parameters.
* For instance, to make the width of an image 150 pixels,
* and change the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes the "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize.
* Any suggestions for performance increase are welcome.
@chicoxyzzy
chicoxyzzy / noncoercible.js
Last active Mar 15, 2021
Non-coercible objects
View noncoercible.js
function nonCoercible(val) {
if (val == null) {
throw TypeError('nonCoercible shouldn\'t be called with null or undefined');
}
const res = Object(val);
res[Symbol.toPrimitive] = () => {
throw TypeError('Trying to coerce non-coercible object');
}
return res;
};
@unitycoder
unitycoder / UNITY_MATRIX_IT_MV.shader
Last active Jun 7, 2021
UNITY_MATRIX_IT_MV[] Vectors in Shader
View UNITY_MATRIX_IT_MV.shader
UNITY_MATRIX_IT_MV[0].xyz = ???
UNITY_MATRIX_IT_MV[1].xyz = Camera Up
UNITY_MATRIX_IT_MV[2].xyz = Camera Forward
Camera right direction = UNITY_MATRIX_V[0].xyz = mul((float3x3)UNITY_MATRIX_V,float3(1,0,0));
Camera up direction = UNITY_MATRIX_V[1].xyz = mul((float3x3)UNITY_MATRIX_V,float3(0,1,0));
Camera forward direction = UNITY_MATRIX_V[2].xyz = mul((float3x3)UNITY_MATRIX_V,float3(0,0,1));
Camera position = _WorldSpaceCameraPos = mul(UNITY_MATRIX_V,float4(0,0,0,1)).xyz;
//http://forum.unity3d.com/threads/get-main-camera-up-direction.189947/#post-1297952
@karpathy
karpathy / min-char-rnn.py
Last active Jun 10, 2021
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
View youtube-vimeo-url-parser.js
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551