Skip to content

Instantly share code, notes, and snippets.

@nibasya
nibasya / half-automatic_troops.blueprint
Created Jun 11, 2020
Half-automatic troops for Factorio using AAI Programmable Vehicles
View half-automatic_troops.blueprint
0eNrtfctyI0ey5b/UsqdQFh7vaOvW5vZCi7mb2xvJxtrKWEVUCSaQoBFkqWnX9AHzHzM/Nl8yAAiSiYz0dPfIBAkmYtPWkshgZrrHOccj/PHfH74s7+c3t4vruw9//e8Pi6+r6/WHv/6v//6wXny/vlhu/93dw838w18/LO7mVx8+fri+uNr+0/314m62+eG729Xyw58fPyyuL+f//vBX+PMj+as/5r8tvi7ns+XFen47u7u4/r35f79eXF+vrhtLmj//9fHD/PpucbeYPz7a7h8ePl/fX32Z327+5vPKXxbfZ/Pl/Ovd7eLr7Ga1nG/+6M1qvfnNzYqbx9msNgPzyX388LD5f0Z/cps/s3mJ682vLHYv/t8fYPs/t/PL5l9abP4J7OZHF7df7xd3j//857/+/HP7tq2n0c9PczW/XNxfkQ9kwv5xoGs5I15O9S1npctp07ecky4Hvm85X2pJJbKka1vy48F/NzYitg3S1019bxvFtuhbLQlXc32LgRKuBr3PBiBdrvfDgXSP6V6vA1PodjpK3M4A4XbOIW4HL7v24nZx99vV/G7zeF9XV18W1xd3q9uuh1Qve2PziJeL28cn3OHTHrY/f5n/dvFjsfn9zS+9LPx5858vF8+v821xu777nEH6j8Xt3f3m3zw/2eNPzOYXX3/bgvd6vl1mu9Z6A+sbbtl41Opmfnvx+BQf/sfmN1f3dzf34rX/FOz0zQf9+EFjBjE8RAc34PPrdL6f34/z+V9Y4XL+dXG5EQq9394JP/1+0WHf/efGR+d/0Ov57feHD7sPenVzcbt7ob9++H//+/8WWOd/Pq5z87B5kfvru8/fbldXnxfXmzU+/PXbxXI9FxiubRqdMWRuOtzQEJiGDjJDm7cw9P4zP20r3bLd3wss988RLbfdLBLL6X7LRablohwhTw0gZ3CIkH8psOR/yNgpiGyRmLZIol2k3mIT/cfhJlKtTfS3sk8/3iaKmWE+fvh+O59fZ0ApMqFWmQmZ66LBppJuPP1G++4
@nibasya
nibasya / EdgeCounter.blueprint
Last active Jun 9, 2020
Edge Counter for Factorio
View EdgeCounter.blueprint
0eNrll0uOm0AQhu9Sy6Qd8bCNhUaz8TarZBlZCEN5XBJ0o6axYll9gNwjuVhOkm5IPIzxA0gyjpSNrX79FPX55zcHWGcVFpK4gvAAlAheQvjpACU98Tizc2pfIIRACnNgwOPcjlJMKEU5SUS+Jh4rIUEzIJ7iZwhdzW4KxJLUNkdFyXkNT68YIFekCJuK6sE+4lW+RmkucpSyNauYq7YQg0KU5qzgtgKjN5kx2JsvUxukJDFp1jxmjyspsmiN23hH5qw5sKFMobzQiR1JVZmZYwHNjsl7W34iKtvKRasZq3qa8+aapVVy7YfEtH1jlDblkEwqUvWwbmRreX66vNK6teVXa7xrmLqd8d4N6s1PzcispXS8ow3JUkVDe9WAq9tlSixiWZcYwvcv38wRUamiGiD6oREt9lFNIdpIkUfEjQaEmzgrUfcn0WDzLqz6/UD4N37uXRbOMBbPsr+HA+Nka5tXopWJnsFMjM1EgYZLXQa8GYFlCVqPtoB3lcO0H4fpIEO4d/DD8qUfnBM/PIxr+x9zg9+BwuBJIvLTjYsh9GYdev1UL2GeDbWbfx+3Lc9azXnptLd/3WmzU1bsmreGojxLaD4umZy7BZPTCaavI7h8fLVgCvpxCEYHk/O/5tJ8iB16PrAWo3LJ+Wdi6fHOsRT0jaXp9Ufd5dTqF0fs9p8SU1n9AhS2XrgY7MxLRg0xCHzX9YNg6iy0/gGu/axX
@nibasya
nibasya / CProgressDlg.cpp
Created May 4, 2020
Example of creating worker thread
View CProgressDlg.cpp
bool CProgressDlg::AddThread()
{
// Snip
CConvert* pConv = new CConvert();
CWinThread* pThread;
pThread = AfxBeginThread(CConvert::MainThread, pConv); // 重い処理をワーカースレッドで処理
// Snip
}
UINT __cdecl CConvert::MainThread(LPVOID pData)
@nibasya
nibasya / CStatusDlg.h
Created May 4, 2020
A dialog with independent User Interface thread (CWinThread)
View CStatusDlg.h
#pragma once
const int ID_UPDATE_STATUS = 40000;
class CStatusDlg : public CDialogEx
{
DECLARE_DYNAMIC(CStatusDlg)
public:
@nibasya
nibasya / CFindStatusDlgThread.cpp
Created Mar 25, 2020
An example of user interface thread implementation
View CFindStatusDlgThread.cpp
#include "pch.h"
#include "ShowOfflineFiles.h"
#include "ShowOfflineFilesDoc.h"
#include "CFindStatusDlg.h"
#include "CFindStatusDlgThread.h"
// CFindStatusDlgThread
IMPLEMENT_DYNCREATE(CFindStatusDlgThread, CWinThread)
@nibasya
nibasya / CShowOfflineFilesDoc.cpp
Created Mar 11, 2020
Example of finding CView from CDocument
View CShowOfflineFilesDoc.cpp
void CShowOfflineFilesDoc::Example()
{
CView* pv = FindView(RUNTIME_CLASS(CSearchResult));
}
CView* CShowOfflineFilesDoc::FindView(CRuntimeClass* rc)
{
POSITION p = GetFirstViewPosition();
CView* pRet;
while (p != NULL) {
@nibasya
nibasya / RPTT.h
Last active Feb 23, 2020
TCHAR version of _RPTN functions
View RPTT.h
#pragma once
#ifndef _DEBUG
#define _RPTT0(msg)
#define _RPTTN(msg, ...)
#define _RPTFT0(msg)
#define _RPTFTN(msg, ...)
#else // ifndef _DEBUG else
#ifdef UNICODE
#define _RPTT0(msg) _RPT_BASE_W(_CRT_WARN, NULL, 0, NULL, L"%ls", msg)
@nibasya
nibasya / CConvertLock.cpp
Created Feb 9, 2020
Aborting by using CEvent and CMultiLock
View CConvertLock.cpp
CConvertLock::CConvertLock(CSyncObject* pSyncAbort, CSyncObject* pSyncObj) :
m_pLock(NULL)
{
m_SyncObj[0] = pSyncAbort;
m_SyncObj[1] = pSyncObj;
m_pLock = new CMultiLock(m_SyncObj, 2);
}
CConvertLock::~CConvertLock()
@nibasya
nibasya / MessageSpeeedTestDlg.cpp
Created Feb 8, 2020
SendMessage / PostMessage speed test
View MessageSpeeedTestDlg.cpp
UINT __cdecl TestThread(LPVOID pData)
{
CMessageSpeedTestDlg* p = static_cast<CMessageSpeedTestDlg*>(pData);
QueryPerformanceCounter(&p->m_Begin);
p->SendMessage(WM_USER_COMPLETE);
return 0;
}
void CMessageSpeedTestDlg::OnBnClickedButtonStart()
@nibasya
nibasya / DE10Controller.cs
Last active Aug 13, 2019
An example using local class which groups some data
View DE10Controller.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DE10Controller : MonoBehaviour
{
[System.Serializable]
public class Wheel
{
public List<Rigidbody> wheels;
You can’t perform that action at this time.