This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <WinSock2.h> | |
#include <ws2tcpip.h> | |
#pragma comment(lib, "Ws2_32.lib") | |
void run_client() | |
{ | |
WSADATA wsaData; | |
WSAStartup( MAKEWORD(2,2), &wsaData ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--package.cpath = package.cpath..';'..'C:\\devel\\luaexpat-1.2.0\\luaexpat-1.1.win32-lua51' | |
require("lxp") | |
sample_text = "<elem1>text<elem2>inside text</elem2>more text</elem1>" | |
local count = 0 | |
callbacks = { | |
StartElement = function(parser, name) | |
io.write( string.rep(" ", count), "+", name, "\n" ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
files = glob.glob("C:\\path\\*.exe") | |
for file in files: | |
os.rename(file, file.replace(".exe", ".com")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <regex> | |
#include <iostream> | |
#include <exception> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
std::string source = "{pa,tt}, {e, rn}"; | |
try | |
{ | |
std::regex pattern("\\{.*?\\}", std::regex_constants::ECMAScript); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <windows.h> | |
PVOID ParentFiber; | |
VOID WINAPI logicFiber (PVOID pvParam) { | |
printf("logicFiber\n"); | |
SwitchToFiber(ParentFiber); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
namespace split_jpg { | |
class Program { | |
static void Main (string[] args) { | |
try { | |
string filename = args[0]; | |
Bitmap src = Image.FromFile(filename) as Bitmap; | |
int split = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
template <typename T> | |
class TSingleton { | |
public: | |
TSingleton() {} | |
~TSingleton() { | |
delete(Instance_); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import fnmatch | |
prefix = "page-" | |
postfix = ".jpg" | |
add_num = 1; | |
digits = 3; | |
v = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace FloydAlgorithm { | |
public class Floyd { | |
public void floyd (int n, Graph W, ref Graph D) { | |
int i, j, k; | |
D.CopyFrom(W); | |
for (k = 0; k < n; k++) { | |
for (i = 0; i < n; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace PrimAlgorithm { | |
public class Graph<T> { | |
private List<Node> nodes_ = new List<Node>(); | |
public class Node { | |
private List<Edge> edges_ = new List<Edge>(); | |
private T context_; |