Skip to content

Instantly share code, notes, and snippets.

View SeriousM's full-sized avatar
🌟
Focusing

Bernhard Millauer SeriousM

🌟
Focusing
View GitHub Profile
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active May 12, 2024 13:59
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@josephhainline
josephhainline / convert_github_md_to_gitlab_format.sh
Created May 10, 2015 02:30
If you have repos in github that you'd like to port to gitlab, with all branches and tags, this will do it. If you want to port your wikis too, this will also work, although it's only a 90% solution for wikis. Github and gitlab use different file name and markdown conventions. Run the command port_repos_and_wikis_from_github_to_gitlab.sh to get …
#!/bin/bash
echo
echo "Processing all *.md files in current directory..."
echo
# Loop through all .md files in directory and rename spaces to dashes
for file in *" "*; do
echo "Renaming $file"
mv -- "$file" "${file// /-}"
@SeriousM
SeriousM / readme.md
Created August 8, 2014 11:28
Extract Generic Type Definition in C#
void Main()
{
	GetTypeFromList(new List<string>()).Dump();
	GetTypeFromFunc((string s, int i) => true).Dump();
}

public Type GetTypeFromList<TType>(IEnumerable<TType> dummy)
{
	return typeof(TType);
@TemporaryJam
TemporaryJam / Howto convert a PFX to a seperate .key & .crt file
Last active April 4, 2024 10:52
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
void Main()
{
var x = XDocument.Load(@"...\packages.config")
.Document.Root.Elements().Select (r => r.Attribute("id").Value)
.Select (r => {
var cq = CsQuery.CQ.CreateFromUrl("https://www.nuget.org/packages/" + r);
return new{
Package = r,
License = cq[".licenseName"].Html(),
LicenseUrl = cq["a"].Single (el => el.InnerText == "License")["href"]
@willurd
willurd / web-servers.md
Last active May 23, 2024 20:20
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
namespace YourNamespace
{
/// <summary>
/// Uses the Name value of the <see cref="ColumnAttribute"/> specified to determine
/// the association between the name of the column in the query results and the member to
/// which it will be extracted. If no column mapping is present all members are mapped as
/// usual.
/// </summary>
/// <typeparam name="T">The type of the object that this association between the mapper applies to.</typeparam>
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper