Initially taken by Niko Matsakis and lightly edited by Ryan Levick
- Introductions
- Cargo inside large build systems
- FFI
- Foundations and financial support
/** | |
* | |
* @author hengyunabc 2017-10-12 | |
* | |
*/ | |
public class ClassLoaderUtils { | |
@SuppressWarnings({ "restriction", "unchecked" }) | |
public static URL[] getUrls(ClassLoader classLoader) { | |
if (classLoader instanceof URLClassLoader) { | |
return ((URLClassLoader) classLoader).getURLs(); |
# coding:utf-8 | |
from elasticsearch import Elasticsearch | |
import json | |
# Define config | |
host = "127.0.0.1" | |
port = 9200 | |
timeout = 1000 | |
index = "index" |
/* JVMCPUUsage | |
* | |
* Calculate JVM CPU usage on older than JDK version 7 using MXBeans. | |
* | |
* First initiate MBeanServerConnection using `openMBeanServerConnection` method. Then | |
* create proxy connections to MXBeans using `getMXBeanProxyConnections` and after that | |
* poll `getJvmCpuUsage` method periodically. | |
* | |
* JVMCPUUsage is a free Java class: | |
* you can redistribute it and/or modify it under the terms of the GNU General Public License |
import java.lang.reflect.Method; | |
import java.util.Arrays; | |
public class Bytecodes { | |
static { | |
System.loadLibrary("bytecodes"); | |
} | |
private static native byte[] getBytecodes(Method method); |
// Mini memory editor for Dear ImGui (to embed in your game/tools) | |
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112 | |
// THE MEMORY EDITOR CODE HAS MOVED TO GIT: | |
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor | |
// Click "Revisions" on the Gist to see old version. |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
// Platform independent | |
#include "BitBlitter.h" | |
#include "precompiled_headers.h" // Anything before this is PCH on windows | |
bool BitBlitter::onWindowRefresh( FB::RefreshEvent *evt, FB::PluginWindow *win ) | |
{ | |
boost::mutex::scoped_lock _l(preview_mutex); |
void PluginObject::drawImage(FB::PluginWindow *wnd, FB::PluginEvent* evt, unsigned char *img, int width, int height) { | |
HDC hdc=NULL; | |
BITMAPINFO bitmapInfo; | |
bitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | |
bitmapInfo.bmiHeader.biBitCount=32; | |
bitmapInfo.bmiHeader.biCompression=BI_RGB; | |
bitmapInfo.bmiHeader.biPlanes = 1; | |
bitmapInfo.bmiHeader.biSizeImage = width*height*4; | |
bitmapInfo.bmiHeader.biWidth = width; |