Skip to content

Instantly share code, notes, and snippets.

@olmobrutall
olmobrutall / gist:31d2abafe0b21b017d56
Last active December 21, 2020 09:42
Proposal for C# Non-Nullable Reference Types

Proposal for C# Non-Nullable Reference Types

This document tries to be an ordered compilation of the ideas exposed in https://roslyn.codeplex.com/discussions/541334

Also interesting is the original proposal I based my solution in http://twistedoakstudios.com/blog/Post330_non-nullable-types-vs-c-fixing-the-billion-dollar-mistake

And the uservoice suggestion to get Microsoft feel the urgency: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2320188-add-non-nullable-reference-types-in-c?page=3&per_page=20

Introduction

@eyecatchup
eyecatchup / get-win7-productkey.vbs
Created August 16, 2014 15:52
VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.
Set WshShell = WScript.CreateObject("WScript.Shell")
KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))
@JefClaes
JefClaes / gist:0cfed3f0ad26a75eda1e
Created October 5, 2014 13:05
Event Store PackageFramingException: Package size is out of bounds
[07,09:57:30.489,ERROR] TcpPackageConnection: [127.0.0.1:1113, L127.0.0.1:55697, {d9265236-f72b-4418-a470-780ab7ef2af9}]. Invalid TCP frame received.
EXCEPTION(S) OCCURRED:
EventStore.ClientAPI.Transport.Tcp.PackageFramingException: Package size is out of bounds: 186992564 (max: 67108864).
at EventStore.ClientAPI.Transport.Tcp.LengthPrefixMessageFramer.Parse(ArraySegment`1 bytes)
at EventStore.ClientAPI.Transport.Tcp.LengthPrefixMessageFramer.UnFrameData(IEnumerable`1 data)
at EventStore.ClientAPI.Transport.Tcp.TcpPackageConnection.OnRawDataReceived(ITcpConnection connection, IEnumerable`1 data)
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@rygine
rygine / Login.js
Last active January 26, 2016 20:48
An initial draft at managing local state within the global state tree.
import React, { Component, PropTypes } from 'react';
import { stateful } from './createStateful';
class Login extends Component {
static propTypes = {
state: PropTypes.object,
}
onUserUpdate(evt) {
@jesperronn
jesperronn / docx2md.md
Last active November 21, 2023 12:49 — forked from aembleton/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

@tonysneed
tonysneed / Startup.cs
Last active November 10, 2019 11:42
ASPNetCore: App_Data with LocalDb File
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Set up configuration sources ...
// Set up data directory
string appRoot = appEnv.ApplicationBasePath;
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(appRoot, "App_Data"));
}
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@Arinerron
Arinerron / root.sh
Last active March 7, 2024 09:24
"Root" via dirtyc0w privilege escalation exploit (automation script) / Android (32 bit)
#!/bin/bash
# Give the usual warning.
clear;
echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
sleep 10;
clear;
# Download and extract exploit files.
echo "[INFO] Downloading exploit files from GitHub...";
@kbastani
kbastani / mvnw-fix.sh
Last active April 9, 2024 15:59
Adds a settings.xml file to your Spring Boot maven wrapper
#!/usr/bin/env bash
# Secure workaround for https://issues.sonatype.org/browse/MVNCENTRAL-1369
# Navigate to the root of your Spring Boot project where a Maven wrapper is present and run this script
cd .mvn/wrapper
wget https://gist.githubusercontent.com/kbastani/d4b4c92969ec5a22681bb3daa4a80343/raw/f166086ef051369383b02dfb74317cd07b6f2c6e/settings.xml
cd ../../
./mvnw clean install -s .mvn/wrapper/settings.xml