Skip to content

Instantly share code, notes, and snippets.

View Pharap's full-sized avatar
🇺🇦
Путин - клептократический тиран

Pharap Pharap

🇺🇦
Путин - клептократический тиран
  • 23:23 (UTC +01:00)
View GitHub Profile
@Pharap
Pharap / Arduborg.hex
Last active December 12, 2019 22:57
Resistance is futile
:100000000C948E030C94B6030C94B6030C94B603B4
:100010000C94B6030C94B6030C94B6030C94B6037C
:100020000C94B6030C94B6030C9475070C94E40777
:100030000C94B6030C94B6030C94B6030C94B6035C
:100040000C94B6030C94B6030C94B6030C94B6034C
:100050000C94B6030C94B6030C94B6030C94160AD5
:100060000C94B6030C94B6030C94B6030C94B6032C
:100070000C94B6030C94B6030C94B6030C94B6031C
:100080000C94B6030C94B6030C94B6030C94B6030C
:100090000C94B6030C94B6030C94B6030C94B603FC
@Pharap
Pharap / Vignere.h
Last active March 28, 2019 00:49
Vignere Cipher
#pragma once
//
// Copyright (C) 2019 Pharap (@Pharap)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@Pharap
Pharap / PokittoLua.cpp
Created October 23, 2018 11:11
Pokitto + Lua example
#include "PokittoLua.h"
#include <Pokitto.h>
#include <cstdint>
int Pokitto_Display_getWidth(lua_State * state)
{
lua_pushinteger(state, Pokitto::Display::getWidth());
return 1;
@Pharap
Pharap / SDLInVS.md
Last active October 23, 2018 22:52
Steps to use SDL in VS
  1. VC++ Directories > Include Directories = $(SolutionDir)$(SolutionName)\Include
  2. VC++ Directories > Library Directories = $(SolutionDir)$(SolutionName)\Lib
    • $(SolutionDir)$(SolutionName)\Lib\x64 for x64
    • $(SolutionDir)$(SolutionName)\Lib\x86 for x86
  3. C/C++ > Code Generation > Runtime Library = Multi-threaded DLL (/MD)
  4. Linker > System > SubSystem = Windows (/SUBSYSTEM:WINDOWS)
  5. Linker > Input > Additional Dependencies = SDL2.lib;SDL2main.lib;
@Pharap
Pharap / FuncPtr.cpp
Created October 21, 2018 09:11
Demonstrates that function pointer dereferencing is equivalent to identity
#include <type_traits>
#include <iostream>
int func(void) { return 42; }
int main(void)
{
auto fp0 = func;
auto fp1 = *func;
auto fp2 = *******func;
@Pharap
Pharap / StackOverflow.cs
Created October 13, 2018 03:28
Short C# program that crashes at runtime. Good fun.
namespace StackOverflowProgram
{
class Program
{
static void Main(string[] args)
{
Main(args);
}
}
}
@Pharap
Pharap / NamedParams.cs
Created August 29, 2018 17:59
Weird C# quirk
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public class Base
@Pharap
Pharap / example.cpp
Created August 25, 2018 11:13
ino vs cpp example
// cpp files require these includes
// ino files do not
#include <Arduino.h>
#include <Serial.h>
// cpp files require this predeclaration
// ino files do not
void sendMessage(void);
void setup(void)
@Pharap
Pharap / BSD3ClauseLicence.txt
Created July 22, 2018 17:25
Odd 2-way system
Copyright 2018 Pharap
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
@Pharap
Pharap / Program.cs
Created July 10, 2018 04:22
Generates angles
using System;
using System.IO;
namespace AngleGenerator
{
class Program
{
static void Main(string[] args)
{
double Tau = Math.PI * 2;