Skip to content

Instantly share code, notes, and snippets.

View kengonakajima's full-sized avatar
🏠
Working from home

Kengo Nakajima kengonakajima

🏠
Working from home
View GitHub Profile
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
#include <string.h>
int main() {
int fd=socket(AF_INET,SOCK_STREAM,0);
struct sockaddr_in sa;
sa.sin_family=AF_INET;
sa.sin_port=htons(80);
@kengonakajima
kengonakajima / FFT.cs
Created December 22, 2020 02:35
simple fft
using System;
//////////////////////////////////////////
#region License and Information
/*****
*
* This is an implementation of a complex number class which supports most
* common operations. Though, not all of them has been tested. Some are staight
@kengonakajima
kengonakajima / SampleBuffer.cs
Created December 22, 2020 02:18
audio sampling buffer util
using System;
using UnityEngine;
class Util
{
public static void FloatToBytes(byte[] dest_buf, float[] data, int ofs, int num, float multiply )
{
var bsz = num * 2;
if(dest_buf.Length<bsz) { throw new Exception(); }
for (int i = 0; i < num; i++)
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
import WebKit
class MyViewController : UIViewController {
var webView: WKWebView!
override func loadView() {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimSprite : MonoBehaviour
{
// Start is called before the first frame update
object[] sprites;
void Start()
{
using System;
namespace osslcrashtest1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Mrs3.mrs_initialize();
まずminecraftユーザーにする
sudo su minecraft
起動するコマンドライン (paper/start.shに書いてある)
nohup java -jar paper-86.jar & disown
終了はマイクラのクライアントからやる
/stop
バックアップ時の操作もマイクラのクライアントからやる
hatenablog.com
toranoana.jp
twipple.jp
honya-go.com
but.jp
@kengonakajima
kengonakajima / noise.cpp
Created April 6, 2020 21:45
simple perlin/simplex 2d function, ported from perlin.js
/*
* A speed-improved perlin and simplex noise algorithms for 2D.
*
* Based on example code by Stefan Gustavson (stegu@itn.liu.se).
* Optimisations by Peter Eastman (peastman@drizzle.stanford.edu).
* Better rank ordering method by Stefan Gustavson in 2012.
* Converted to Javascript by Joseph Gentle.
*
* Version 2012-03-09
*
@kengonakajima
kengonakajima / MicrophoneToSocket
Created December 6, 2019 03:20
Unity, capture microphone samples and send it to UDP socket
using System;
using UnityEngine;
using System.Net;
using System.Net.Sockets;
public class Mic : MonoBehaviour {
AudioClip clip;
Socket sk;