Skip to content

Instantly share code, notes, and snippets.

View phr34k's full-sized avatar

Lawrence Kok phr34k

View GitHub Profile
import os
import socket
import jupyterlab.labapp
from tornado.tcpserver import TCPServer
from tornado.httpserver import HTTPServer
from notebook.transutils import trans, _
__version__ = '1.0.1'
SYSTEMD_SOCKET_FD = 3 # Magic number !
std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
{
// If explicitly requested, just use the collada name.
if (useColladaName)
{
if (!pNode->mName.empty()) {
return pNode->mName;
} else {
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
}
<html>
<head>
<title>basic example</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="module" src="sssa-min.js"></script>
</head>
<body>
@phr34k
phr34k / main.cpp
Last active August 29, 2015 14:22
relative to absolute path
#include <windows.h>
#include <stdio.h>
#include <string>
#include <map>
void relative2absolute(std::string& result, const char* relativeFile)
{
int state = 0;
int length = strlen(relativeFile);
result.reserve(length);
@phr34k
phr34k / main.cpp
Created May 30, 2015 17:14
zip archive reader
#include <windows.h>
#include <stdio.h>
#include <string>
#include <map>
#pragma pack(1)
struct package_file
{
unsigned int signature;
unsigned short version;
@phr34k
phr34k / gist:7679738
Created November 27, 2013 17:29
Save 32-bit color rgba bitmap (hbitmap) to a png file using libpng.
#include <windows.h>
#include "extern/png/png.h"
#include <stdio.h>
BOOL SaveToFilePng(HBITMAP hBitmap, LPCSTR lpszFileName)
{
BITMAP Bitmap;
GetObject(hBitmap, sizeof(Bitmap), (LPSTR)&Bitmap);
unsigned int bitmap_bytes_per_pixel = 4;
unsigned int bitmap_scanline_size = (((Bitmap.bmWidth * bitmap_bytes_per_pixel) + (4 - 1)) & ~(4 - 1));
@phr34k
phr34k / main.cpp
Last active November 22, 2021 03:21
Ssh connection with file-serving via lib-ssh and NFSv2. Can be used connect to linux-based target machine from windows, on the same network though, and execute file-served files. Example usage: -t 192.168.0.1 -u user -p 22 -cwd "myworkingdirectoy" -cmd "./window". Intended for serving and executing cross compiled binaries.
#include <libssh/libssh.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <string>
#include <windows.h>
#include <map>
#include <vector>
#include <assert.h>