Skip to content

Instantly share code, notes, and snippets.

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

gollilla gollilla

🏠
Working from home
  • Japan
View GitHub Profile
<?php
use pocketmine\network\mcpe\protocol\AnimateEntityPacket;
$pk = AnimateEntityPacket::create("animation.idle_back_1", "none", "query.any_animation_finished", "", 2.0, [$player->getId()]);
$player->dataPacket($pk);
@gollilla
gollilla / ParallelMontecarlo.php
Last active August 30, 2023 14:46
Parallelを使ってモンテカルロを並列計算
<?php
const N = 100000000;
$para_count = 12;
$parallel = new ParallelFor(function(int $c){
$x = mt_rand() / mt_getrandmax();
$y = mt_rand() / mt_getrandmax();
if(($x**2 + $y**2)**2 < 1) $c++;
return $c;
<?php
//montecarlo
const N = 1000000000;
/*$counter = 0;
for($i=0;$i<N;$i++){
$x = mt_rand() / mt_getrandmax();
$y = mt_rand() / mt_getrandmax();
if(($x**2 + $y**2)**2 < 1) $counter++;
}
<?php
use pocketmine\event\player\PlayerJoinEvent;
use bossbarapi\bossbar\BossBar;
class api_usage {
function onJoin(PlayerJoinEvent $ev){
$player = $ev->getPlayer();
$bossBar = BossBar::create($player);
$bossBar->setTitle("Sample");
<?php
// Your code here!
class Switcher {
public static $calls = [];
public static function register($case, Closure $callback){
self::$calls[$case] = new Executor($callback);
}
public static function onCase($case){
<html>
<head>
<title>TEST</title>
</head>
<body>
<div id="editor" style="height: 600px" oninput="input(this)" onkeyup="input(this)"></div>
<script>
function GetQueryString() {
var result = {};
if (1 < window.location.search.length) {
<?php
class Switcher {
public static $calls = [];
public static function register($case, Closure $callback){
self::$calls[$case] = new Executor($callback);
}
$player = $ev->getPlayer();
$pk = new \pocketmine\network\mcpe\protocol\PlaySoundPacket();
$pk->soundName = "music.mymusic"; // mymusic.ogg の場合
$pk->x = $player->x;
$pk->y = $player->y;
$pk->z = $player->z;
$pk->volume = 0.5;
$pk->pitch = 1.0;
$player->dataPacket($pk);
$player->sendMessage("Send");
<?php
require './vendor/autoload.php';
use Ramsey\Uuid\Uuid;
const WORKING_SPACE_DIR = "./music_working_space/";
var_dump($_FILES);
<?php
// https://paiza.io/projects/szvtfJnxiwMhun_ndDxs6w
$a = [4,8,16,32,64,900];
for($i=0;$i<count($a);$i++){
$h = 1 / $a[$i];
$y0 = y(0);
$yn = y(1);
$x = 0;
$y = 0;