This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| class IntBuff { | |
| public: | |
| IntBuff() = default; | |
| explicit IntBuff(size_t sz) : sz(sz) { | |
| if (sz) { | |
| arr = new int[sz]; | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Eigen/Core> | |
| #include <Eigen/Sparse> | |
| using namespace std; | |
| using namespace Eigen; | |
| void sinitialize(VectorXd &s,double mu,unsigned int sizex,VectorXd &x) | |
| { | |
| for (unsigned int i=0;i<sizex;i++) | |
| if (x[i]!=0)s[i] = mu/x[i]; | |
| else s[i]=0.1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| w = 400 | |
| h = 300 | |
| def normalize(x): | |
| x /= np.linalg.norm(x) | |
| return x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Vue.component('jscolor', { | |
| template: '<input v-model="value" class="jscolor"/>', | |
| props : ['value'], | |
| mounted : function(){ | |
| window.jscolor.installByClassName('jscolor'); | |
| this.$el.jscolor.fromString(this.value); | |
| $(this.$el).on('change', function(_this){ | |
| return function(){ | |
| _this.$emit('input', this.value); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import time | |
| import random | |
| import json | |
| import sys | |
| access_token = "access_token=[APP的Token]" | |
| base_url = "https://graph.facebook.com/v2.3/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tornado.ioloop | |
| import tornado.web | |
| @tornado.gen.coroutine | |
| def getstr(): | |
| raise tornado.gen.Return("Hello coroutine") | |
| class MainHandler(tornado.web.RequestHandler): | |
| @tornado.gen.coroutine | |
| def get(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \NeedsTeXFormat{LaTeX2e}[1994/06/01] | |
| \ProvidesPackage{haflag}[2015/03/22 HAFlag Package] | |
| \usepackage{tikz} | |
| \newcommand{\haflag}[1]{% text | |
| \begin{tikzpicture}[scale=0.1,rotate=-10,shift={(-15, 0)},overlay,remember picture] | |
| \draw[fill=black, thick] (0,0) -- ++ (0,8) arc (180:0:0.4 and 0.1) -- ++ (0,-8) arc (360:180:0.4 and 0.1); | |
| \draw[thick] (0,8) arc (180:360:0.4 and 0.1); | |
| \draw[fill=white,thick] (0.8,7.5) to[out=-30,in=210] ++(3,0) to[out=30,in=150] ++ (3,0) -- ++ (0,-4.5) to [out=150,in=30] ++(-3,0) to[out=210,in=-30] ++(-3,0) -- cycle; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <OpenAL/al.h> | |
| #include <OpenAL/alc.h> | |
| #include <string> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <iostream> | |
| #include <cstring> | |
| #define NUM_BUFFERS 2 | |
| #define NUM_SOURCES 2 | |
| #define NUM_ENVIRONMENTS 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<map> | |
| #include<cstdio> | |
| #include<cstdlib> | |
| typedef std::map<int, int> mic; | |
| typedef std::map<int, int>::iterator itmic; | |
| int main(){ | |
| mic mmap; | |
| itmic it; | |
| for(int lx = 0;lx < 100000;lx++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| from pygame.locals import * | |
| def main(): | |
| pygame.init() | |
| pygame.font.init() | |
| screen = pygame.display.set_mode((600, 600), 0, 32) | |
| pygame.display.set_caption("Hello world") | |