Skip to content

Instantly share code, notes, and snippets.

View caphosra's full-sized avatar
🪄
Obj.magic!

Akihisa Yagi caphosra

🪄
Obj.magic!
View GitHub Profile
@caphosra
caphosra / ObjectPooling.cs
Last active October 21, 2019 13:40
My Unity Object Pooing Code
//
// (c) 2019 capra314cabra
//
// https://gist.github.com/capra314cabra/e95ab177e3f089e3db3ad13ac0ec20f5
//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@caphosra
caphosra / kyopuro.cpp
Last active January 7, 2021 09:27
Kyopuro Header
//-------------------------------
#define ACTIVATE_GCC_OPT
#define UNION_FIND_TYPE int
//-------------------------------
#ifdef ACTIVATE_GCC_OPT
# pragma GCC target("avx2")
# pragma GCC optimize("O3")
@caphosra
caphosra / Microsoft.PowerShell_profile.ps1
Created December 12, 2019 06:14
Implementation of sudo command on Powershell
# A function that runs some commands with administrator rights.
function SudoRun
{
# Set commands to $program.
foreach($arg in $args)
{
$program = "$program $arg"
}
# Run it by Powershell with administrator rights.
@caphosra
caphosra / EditProfile.ps1
Created February 6, 2020 13:00
How to edit the powershell profile
pwsh
# PowerShell 6.2.3
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# https://aka.ms/pscore6-docs
# Type 'help' to get help.
$profile
# C:\.....\Microsoft.PowerShell_profile.ps1
@caphosra
caphosra / llvm-printf-float.cpp
Last active April 15, 2021 08:54
[LLVM, C++] Print the answer of the sum of two float values
#include <iostream>
#include <fstream>
#include <memory>
#include <vector>
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
@caphosra
caphosra / input.cpp
Created April 17, 2020 05:00
Compile cpp file by Clang++
#include <stdio.h>
int main()
{
double d1 = 3;
double d2 = 5;
scanf("%d %d", &d1, &d2);
printf("%d + %d = %d", d1, d2, (d1 + d2));
return 0;
}
@caphosra
caphosra / rm_unity_dialog.py
Created June 24, 2020 02:33
Detele mobile warning dialog from Unity WebGL build
import pathlib
delete_func = "compatibilityCheck:function(e,t,r){UnityLoader.SystemInfo.hasWebGL?UnityLoader.SystemInfo.mobile?e.popup(\"Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway.\",[{text:\"OK\",callback:t}]):[\"Edge\",\"Firefox\",\"Chrome\",\"Safari\"].indexOf(UnityLoader.SystemInfo.browser)==-1?e.popup(\"Please note that your browser is not currently supported for this Unity WebGL content. Press OK if you wish to continue anyway.\",[{text:\"OK\",callback:t}]):t():e.popup(\"Your browser does not support WebGL\",[{text:\"OK\",callback:r}])}"
expected_func = "compatibilityCheck:function(e,t,r){r();}"
def main():
path = input("Input the directory path of UnityLoader.js > ")
path = str(pathlib.Path(path).joinpath("UnityLoader.js"))
script = ""
with open(path, "r") as fs:
@caphosra
caphosra / Dockerfile
Created August 4, 2020 01:20
Docker image for CTF
FROM ubuntu:latest
RUN \
########################################################
#
# Basic tools
#
########################################################
cd /; \
apt update; \
@caphosra
caphosra / requirements.txt
Created August 5, 2021 04:28
My tensorflow environment
absl-py==0.8.1
astor==0.8.0
attrs==19.3.0
backcall==0.1.0
beautifulsoup4==4.9.0
bleach==3.1.0
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
colorama==0.4.3
# Use UTF-8 as a charset.
[System.Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding("utf-8")
[System.Console]::InputEncoding = [System.Text.Encoding]::GetEncoding("utf-8")
$env:LESSCHARSET = "utf-8"
# Change the theme.
Set-PoshPrompt -Theme powerlevel10k_modern
If ($IsWindows) {
# Create a new command which is equivalent to the "which" keyword in Linux.