Skip to content

Instantly share code, notes, and snippets.

@Mpdreamz
Mpdreamz / gist:997984
Created May 29, 2011 17:39
WPF force software rendering
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}
}
@libertylocked
libertylocked / Primitives2D.cs
Last active February 14, 2022 12:02
MonoGame Primitives2D (Fixed pixels offset for DrawLine)
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace C3.XNA
{
/// <summary>
/// </summary>
public static class Primitives2D
@maxvyaznikov
maxvyaznikov / raw.js
Last active October 15, 2022 02:19
NodeJS, raw-socket, custom TCP/IPv4 SYN-packet sending
var raw = require("raw-socket");
var ip = require('ip');
var util = require('util');
function send(src_ip, src_port, dst_ip, dst_port) {
var socket = raw.createSocket({
protocol: raw.Protocol.TCP, // See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
addressFamily: raw.AddressFamily.IPv4
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakobii
jakobii / HTTPServer.ps1
Last active April 5, 2023 08:37
A Basic Powershell Webserver
# You Should be able to Copy and Paste this into a powershell terminal and it should just work.
# To end the loop you have to kill the powershell terminal. ctrl-c wont work :/
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
@swlaschin
swlaschin / Calculator_implementation.fsx
Last active July 30, 2023 14:50
Type-first design and implementation for a calculator app
(*
Calculator_implementation.fsx
Related blog post: http://fsharpforfunandprofit.com/posts/calculator-implementation/
*)
// ================================================
// Draft of Domain from previous file
// ================================================
module CalculatorDomain_V3 =
@benbalter
benbalter / gist.md
Last active November 2, 2023 02:04
Example of how to embed a Gist on GitHub Pages using Jekyll.

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

@Elfocrash
Elfocrash / IntegrationTest.cs
Created July 10, 2019 10:40
ASP.NET Core Integration tests code from my video: https://www.youtube.com/watch?v=7roqteWLw4s
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Tweetbook.Contracts.V1;
using Tweetbook.Contracts.V1.Requests;
using Tweetbook.Contracts.V1.Responses;
@tanaikech
tanaikech / submit.md
Last active January 4, 2024 09:59
Transposing Slice From (n x m) To (m x n) for golang

Transposing Slice From (n x m) To (m x n) for golang

This is a sample script for transposing slice from (n x m) to (m x n) for golang.

Script :

package main

import "fmt"

func transpose(slice [][]string) [][]string {
@kg
kg / decodeFloat.js
Created March 25, 2012 10:53
Decode 32/64-bit float from bytes in JavaScript
// Derived from http://stackoverflow.com/a/8545403/106786
function decodeFloat(bytes, signBits, exponentBits, fractionBits, eMin, eMax, littleEndian) {
var totalBits = (signBits + exponentBits + fractionBits);
var binary = "";
for (var i = 0, l = bytes.length; i < l; i++) {
var bits = bytes[i].toString(2);
while (bits.length < 8)
bits = "0" + bits;