Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🏭
at work

Gabriel Valky gabonator

👨‍🏭
at work
View GitHub Profile
@gabonator
gabonator / spipe.cpp
Created Apr 26, 2012
Socket connector - double server
View spipe.cpp
// spipe.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//#include <signal.h>
BOOL m_bRunning = FALSE;
class CNetwork {
public:
View Tables.cpp
#include <pch.h>
#include "Tables.h"
#define foreach(decl) for ( decl = m_pListFirst; pElement; pElement = pElement->m_pNext )
/*virtual*/
void CTableWnd::GetClientRect( LPRECT prcRect )
{
_ASSERT(prcRect);
CRect *pRect = (CRect*) prcRect;
@gabonator
gabonator / usb.cpp
Created Apr 26, 2012
USB enumerating tools
View usb.cpp
#include "usb.h"
#ifndef DISABLE_USB
#pragma comment(lib, "setupapi.lib")
#include "SetupAPI.h"
#include "cfgmgr32.h"
#pragma pack(4)
View TimeZonesDlg.cpp
// TimeZonesDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TimeZonesMFC.h"
#include "TimeZoneDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
@gabonator
gabonator / ft.cpp
Created May 3, 2012
discrete Fourier transform
View ft.cpp
// fourier.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <math.h>
#include <iostream>
using namespace std;
//#include <windows.h>
typedef float FLOAT;
@gabonator
gabonator / exceptions.cpp
Created May 8, 2012
Windows CE stack dumping
View exceptions.cpp
void DeviceExceptionHandler( void *pep )
{
if ( !_DeviceExceptionHandler((LPEXCEPTION_POINTERS)pep) )
{
MessageBox(NULL, _T("Cannot generate dumpreport!"), _T("Illegal operation report"), MB_OK);
}
}
#include <Tlhelp32.h>
#include <vector>
@gabonator
gabonator / clip.cpp
Created Jul 3, 2012
Line to rectangle clipping
View clip.cpp
//http://stackoverflow.com/questions/99353/how-to-test-if-a-line-segment-intersects-an-axis-aligned-rectange-in-2d
enum {
OUT_LEFT = 1,
OUT_TOP = 2,
OUT_RIGHT = 4,
OUT_BOTTOM = 8
};
INT _ThroughCode(LONGPOSITION pt)
@gabonator
gabonator / intersect.cpp
Created Jul 3, 2012
Two lines intersection
View intersect.cpp
LIB_INLINE BOOL32 CMath::MathRayIntersect ( POINT A1, POINT A2, POINT B1, POINT B2, POINT *lpResult )
{
INT dx1 = A2.x - A1.x;
INT dy1 = A2.y - A1.y;
INT dx2 = B2.x - B1.x;
INT dy2 = B2.y - B1.y;
DOUBLE q = (dx1 * dy2) - (dy1 * dx2);
if (abs(q) < 0.0001) q = 0.0001;
@gabonator
gabonator / ahoj.txt
Created Oct 21, 2012
Google speech api with non-english language
View ahoj.txt
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Disposition: attachment
Date: Sun, 21 Oct 2012 20:03:54 GMT
Expires: Sun, 21 Oct 2012 20:03:54 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
@gabonator
gabonator / half_inverse_sphere.html
Created Jun 15, 2013
CNC code that cuts half-sphere hole into plastic/wooden cube & that cuts half sphere out of cube, could be used for making mold for Ferrero Rafaello wafer :)
View half_inverse_sphere.html
<html>
<body>
<pre id="console">
</pre>
<script language="javascript">
function log(s)
{
if ( typeof(s) == "string" )
document.getElementById("console").innerHTML += s + "\n";
You can’t perform that action at this time.