Skip to content

Instantly share code, notes, and snippets.

View chiangqiqi's full-sized avatar

alexjiang chiangqiqi

View GitHub Profile
@chiangqiqi
chiangqiqi / linear-layer.py
Created April 16, 2024 12:40
手撕算法
#!/usr/bin/env python3
import numpy as np
class Dense:
def __init__(self, input_width, width):
self._W = np.random.normal(size=(input_width, width))
self._b = np.random.normal(size=(1, width))
self._X = None
#!/usr/bin/env bash
from subprocess import Popen, PIPE
import json
# init.json be like :
'''
{"initdata":
{
"game": {
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <sys/stat.h>
void cat(int rfd) {
int wfd;
static char *buf;
@chiangqiqi
chiangqiqi / badcat.c
Created October 10, 2019 13:34
reimplement linux cat
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <sys/stat.h>
void cat(int rfd) {
int wfd;
static char *buf;
@chiangqiqi
chiangqiqi / playground.py
Created July 24, 2019 03:07
2019 高考理科20题
from manimlib.imports import *
class Playground(Scene):
def construct(self):
semicircle = Arc(fill_opacity=1, angle=PI/2)
self.play(FadeIn(semicircle))
def Range(in_val,end_val,step=1):
return list(np.arange(in_val,end_val+step,step))
@chiangqiqi
chiangqiqi / 3b1b.py
Created July 21, 2019 23:30
2018gaokao
from manimlib.once_useful_constructs.region import Region
# PMobject 有 filter_out 方法,Circle 没有
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
a = ORIGIN
pointB = Dot(point=np.array([-0.5042, 0.8636, 0]))
centerB = np.array([-0.7521, 0.4318,0])
semi_circleA = Arc(angle=np.pi, radius=1)
@chiangqiqi
chiangqiqi / eth_price.py
Last active May 18, 2017 23:48
云币ETH价格
import requests
import json
import pandas as pd
from datetime import datetime
def get_data():
url = 'https://plugin.sosobtc.com/widgetembed/data/period'
data = requests.get(url, {'symbol':'yunbiethcny', 'step':86400})
return json.loads(data.text)
Manipulate[
Module[
{m={-2000,1500},
n={8000, 1500},
radius=15000
},
yuan[\[Alpha]_]={radius* Cos[\[Alpha]],radius*Sin[\[Alpha]]}+m;
With[{p=yuan[\[Alpha]]},
E=m+t*{p-m};
ts=Solve[
#include <vector>
#include <iostream>
using std::vector;
void process(const vector<int>& vec1, vector<int>& vec2) {
unsigned int i = 0;
while(i < vec1.size()) {
if (vec1[i] == 1 && vec1[i+1] == 2) {
// do not copy and skip the other 2
@chiangqiqi
chiangqiqi / createtable.sql
Created March 7, 2016 09:23
hive 创建按照日期分割的表
create table test_partition (
id int,
name string,
no int)
partitioned by(dt string)
row formatdelimited
fieldsterminated by ','
stored astextfile;
load data local inpath '/home/zhangxin/hive/test_hive.txt' overwrite intotabletest_partition partition (dt='2012-03-05');