Skip to content

Instantly share code, notes, and snippets.

View DavidBasarab's full-sized avatar
🏠
Working from home

David Basarab DavidBasarab

🏠
Working from home
View GitHub Profile
@DavidBasarab
DavidBasarab / 6502_instructions.json
Last active October 27, 2019 01:43 — forked from kirbyUK/6502_instructions.json
6502 instruction set in JSON
[
{
"mode" : "Immediate",
"cycles" : "2",
"opcode" : "$69",
"description" : "Add with Carry",
"bytes" : "2",
"name" : "ADC"
},
{
@DavidBasarab
DavidBasarab / 6502_instructions.json
Created October 26, 2019 23:57 — forked from kirbyUK/6502_instructions.json
6502 instruction set in JSON
[
{
"bytes" : "2",
"description" : "Add with Carry",
"name" : "ADC",
"opcode" : "$69",
"mode" : "Immediate"
},
{
"opcode" : "$65",
@DavidBasarab
DavidBasarab / WebCallerAbstractIdea.cs
Created March 5, 2019 11:38
WebCallerAbstractIdea.cs
public class MyWebCaller : WebCaller
{
private static readonly HttpClient client = CreateHttpClient();
public static HttpClient CreateHttpClient()
{
var specialClient = new HttpClient();
specialClient.DefaultRequestHeaders.ExpectContinue = false;
@DavidBasarab
DavidBasarab / FFMPegPrintCodec.cs
Last active April 4, 2018 15:14
FFMPEg Print Codec
var first_hwaccel = ffmpeg.av_hwaccel_next(null);
var hwaccel = first_hwaccel;
while (hwaccel != null)
{
var codecName = Marshal.PtrToStringAnsi((IntPtr)hwaccel->name);
Log.Error($"{ffmpeg.avcodec_get_name(hwaccel->id)} | ID : {hwaccel->id} | {(int)(hwaccel->id)} | {hwaccel->pix_fmt} | {codecName}");
var codec = ffmpeg.avcodec_find_encoder_by_name(codecName);
#include <stdio.h>
#include <vector>
#include <windows.h>
#include <iostream>
#include <fstream>
#include <time.h>
#define _XOPEN_SOURCE 600 /* for usleep */
extern "C"
{
// Roughly based on: https://ffmpeg.org/doxygen/trunk/muxing_8c-source.html
#include <chrono>
#include <thread>
#include <tchar.h>
extern "C"
{
#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
@DavidBasarab
DavidBasarab / Wcf.cs
Created April 13, 2017 17:23
WCF Test Sample for Stackoverflow
using System;
using System.ServiceModel;
using System.Threading.Tasks;
namespace WcfTest
{
[ServiceContract]
public interface ITestService
{
[OperationContract]
@DavidBasarab
DavidBasarab / ReturnsInOrder
Last active August 29, 2015 13:58
Moq extensions to have the same call return in order different results.
internal static class MoqExtensions
{
public static void ReturnsInOrder<T, TResult>(this ISetup<T, TResult> setup, params TResult[] results) where T : class
{
setup.Returns(new Queue<TResult>(results).Dequeue);
}
}
@DavidBasarab
DavidBasarab / ConsoleExtensions
Created August 26, 2012 00:10
Console extension methods. For help writing items to the console in nice color.
public static class Extensions
{
[Flags]
public enum NewLineLocation
{
None = 0,
Before = 1,
After = 2,
Both = Before | After
}
@DavidBasarab
DavidBasarab / AutoGenerateCRUD.sql
Created August 1, 2012 03:16
Autogenerate CRUD procedures for a database.
-- #########################################################
-- Author: www.sqlbook.com
-- Copyright: (c) www.sqlbook.com. You are free to use and redistribute
-- this script as long as this comments section with the
-- author and copyright details are not altered.
-- Purpose: For a specified user defined table (or all user defined
-- tables) in the database this script generates 4 Stored
-- Procedure definitions with different Procedure name
-- suffixes:
-- 1) List all records in the table (suffix of _lst)