Skip to content

Instantly share code, notes, and snippets.

View mkropat's full-sized avatar
📚
Learning

Michael Kropat mkropat

📚
Learning
View GitHub Profile
@CodesInChaos
CodesInChaos / Hkdf.cs
Created January 30, 2014 14:57
HKDF in C#
class Hkdf
{
Func<byte[],byte[],byte[]> keyedHash;
public Hkdf()
{
var hmac = new HMACSHA256();
keyedHash = (key, message)=>
{
hmac.Key=key;
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@bhcleek
bhcleek / recover-index.md
Last active November 6, 2022 11:09
recover lost index

to recover files that were added to the index but whose changes were lost (e.g. git reset --hard)

git fsck --unreachable | grep commit | cut -d\  -f3 | xargs git show
  1. git fsck --unreachable to get all the items that are unreachable
  2. grep commit to filter out all entries except for commits (the index will show up as a commit)
  3. cut -d\ -f3 to filter out all but the SHA1s
  4. xargs git show to show all of the contents of the objects.

Once you've identified the SHA1 that contains the changes that were lost, check it out to get the working tree back into the state of the index at the time git reset --hard was run.

@crazybyte
crazybyte / certs.txt
Created November 25, 2012 09:45
OpenSSL transformations
NOTE: HTTP SSL keys are all in PEM format (base64 encoded)
#From PEM format to DER
openssl x509 -in $1.crt -out $1.der -outform DER
#From DER format to PEM
openssl x509 -in $1.der -inform DER -out $1.pem -outform PEM
#Transforming RSA key to DER format
openssl rsa -in oberon.key -inform PEM -out oberon_key.der -outform DER
@dupuy
dupuy / README.rst
Last active May 5, 2024 18:42
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@weakish
weakish / README.markdown
Created February 21, 2011 07:02
local and readonly variables in #shell

Local and readonly variables in shells

I've no idea how shells implement them. In this article, I will pretend they use a stack based implementation.

Ksh93 never pops out values. When dash encounteres 'local', it just reuse the outer value. Bash and pdksh/mksh unset values first.