Skip to content

Instantly share code, notes, and snippets.

View mudream4869's full-sized avatar
🪄
Mukyu Learning

神楽坂帕琪 mudream4869

🪄
Mukyu Learning
View GitHub Profile
@mudream4869
mudream4869 / intbuffv1.cpp
Last active March 15, 2020 07:00
intbuffv1.cpp
#include <cstdio>
class IntBuff {
public:
IntBuff() = default;
explicit IntBuff(size_t sz) : sz(sz) {
if (sz) {
arr = new int[sz];
}
};
@mudream4869
mudream4869 / ipm.cpp
Created August 19, 2017 15:30 — forked from censored--/ipm.cpp
IPM
#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;
@mudream4869
mudream4869 / raytracing.py
Created March 22, 2017 16:37 — forked from rossant/raytracing.py
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
import numpy as np
import matplotlib.pyplot as plt
w = 400
h = 300
def normalize(x):
x /= np.linalg.norm(x)
return x
@mudream4869
mudream4869 / vue-jscolor.js
Last active July 25, 2018 11:37
vue-jscolor
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);
}
@mudream4869
mudream4869 / summary.py
Created August 9, 2015 11:32
期末廢文大賽記分板
import requests
import time
import random
import json
import sys
access_token = "access_token=[APP的Token]"
base_url = "https://graph.facebook.com/v2.3/"
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):
@mudream4869
mudream4869 / haflag.sty
Created March 20, 2015 03:53
HonorAlgebra-Flag
\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;
@mudream4869
mudream4869 / altest1.cpp
Last active August 29, 2015 14:13
al load wav + play
#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
@mudream4869
mudream4869 / mpatest.cpp
Created May 28, 2014 10:35
range in map
#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++)
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")