Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
original_data = [
{'globalTime': 1795, 'istTime': [0, 23, 39], 'coordinates': [(173, 289), (171, 289), (170, 289)]},
{'globalTime': 1714, 'istTime': [0, 18, 36], 'coordinates': [(137, 429), (133, 433), (130, 436)]},
]
transformed_data = [
{'globalTime': row['globalTime'], 'istTime': it, 'x': x, 'y': y}
for row in original_data
@Nagasaki45
Nagasaki45 / output_log.txt
Created March 20, 2018 14:49
Unity standalone build crashes after recompiling libpd to 64 bits
Initialize engine version: 2017.4.0f1 (b5bd171ee9ba)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1080 (ID=0x1b80)
Vendor: NVIDIA
VRAM: 8086 MB
Driver: 23.21.13.8813
Begin MonoManager ReloadAssembly
- Completed reload, in 0.414 seconds
@Nagasaki45
Nagasaki45 / error.log
Created March 20, 2018 14:47
Unity standalone build crashes after recompiling libpd to 64 bits
libpd4unity [version: Unity 2017.4.0f1 (b5bd171ee9ba)]
libpdcsharp.dll caused an Access Violation (0xc0000005)
in module libpdcsharp.dll at 0033:66237815.
Error occurred at 2018-03-20_143454.
C:\Users\MAT-VR02\Desktop\tomg\libpd4unity\libpd4unity\Builds\64_upstream_compiled.exe, run by MAT-VR02.
34% memory in use.
16295 MB physical memory [10662 MB free].
18727 MB paging file [11413 MB free].
@Nagasaki45
Nagasaki45 / belize
Last active January 15, 2018 17:19
Manage your Bela project easily
#!/usr/bin/env bash
# Stop Bela upon keyboard interrupts
stop_bela() {
ssh root@192.168.7.2 "cd ~/Bela && make stop"
}
trap stop_bela SIGINT
# Main thingy: upload compile and start

Installing openpose on QMUL EECS machines (CentOS 7.3).

Follow the manual compilation guide with the following changes:

  1. unset CXX (to compile with gcc instead of the default pgc++).
  2. Use Makefile.config.Ubuntu14_cuda8.example as baseline (both in 3rdparty/caffe and root dir).
  3. Edit 3rdparty/caffe/Makefile.config. Set BLAS := open, BLAS_LIB = /usr/include/openblas, BLAS_INCLUDE /usr/include/openblas. Comment out CUDNN flag.
  4. Edit Makefile.config. Add /usr/include/openblas to both INCLUDE_DIRS and LIBRARY_DIRS.
@Nagasaki45
Nagasaki45 / udi_maze.ex
Created March 28, 2017 14:14
Elixir solution to the UdiMaze
defmodule UdiMaze do
@moduledoc """
A solver for UdiMaze pazzle.
Issues:
- I get 404 if omitting the last slash.
- Took me some time to understand the task. It can be documented better.
- Didn't use the `x` and `y` values at all. Without knowing the size of the
maze I can't think of an algorithm that can use them.
@Nagasaki45
Nagasaki45 / reascript_randomiz_item_pan.lua
Created December 15, 2016 02:51
A Reaper ReaScript to randomize the panning of the selected items
selected_item_count = reaper.CountSelectedMediaItems(0)
for i = 0, selected_item_count - 1 do
item = reaper.GetSelectedMediaItem(0, i)
item_take = reaper.GetActiveTake(item)
random_pan = math.random() * 2 - 1
reaper.SetMediaItemTakeInfo_Value(item_take, 'D_PAN', random_pan)
reaper.UpdateItemInProject(item)
end
@Nagasaki45
Nagasaki45 / max_a_filename.py
Created May 24, 2016 08:40
Pick the filename with the largest <a> value from files like "file_<a>.<b>.npy.gz"
import os
import re
re_pattern = r'file_(?P<a>[0-9]*)\.[0-9]*\.npy\.gz'
filenames = os.listdir('.')
matches = [re.match(re_pattern, filename) for filename in filenames]
matches = [match for match in matches if match]
max_a_match = max(matches, key=lambda x: int(x.groupdict()['a']))
max_a_filename = max_a_match.group()
@Nagasaki45
Nagasaki45 / async_client.py
Last active March 14, 2016 16:13
Async http client with asyncio and aiohttp. Example for fetching muliple pages cuncurrently
import aiohttp
import asyncio
import time
urls = ['http://python.org', 'http://www.google.com']
d = {}
async def fetch(client, url):
print('start fetching {}: {}'.format(url, time.time() - start))
@Nagasaki45
Nagasaki45 / Xteams-external-nginx.conf
Last active March 1, 2016 18:55
System wide Nginx configuration for Xteams
server {
listen 80;
server_name xteams.nagasaki45.com;
location / {
proxy_set_header Host xteams.nagasaki45.com;
proxy_pass http://localhost:9768;
}
}