Skip to content

Instantly share code, notes, and snippets.

@dnaeon
dnaeon / decode-rsa-private-key.lisp
Last active November 30, 2022 05:52
Parse ASN.1 encoded RSA private key
;; Decode ASN.1 encoded private key
;;
;; RSA private key format: https://www.rfc-editor.org/rfc/rfc3447#appendix-A.1.2
;;
;; RSAPrivateKey ::= SEQUENCE {
;; version Version,
;; modulus INTEGER, -- n
;; publicExponent INTEGER, -- e
;; privateExponent INTEGER, -- d
;; prime1 INTEGER, -- p
@sgarciav
sgarciav / pass.md
Last active November 9, 2024 13:39
Initialize your password store

About

Summarizing the instructions of the pass tool (as seen on its website).

Getting Started

Installation

Execute: $ sudo apt install pass

@deanishe
deanishe / alfred_alacritty_plugin.applescript
Created September 5, 2020 14:38
Alfred plugin to run terminal commands in Alacritty
on alacritty_win()
set _running to (application "Alacritty" is running)
tell application "Alacritty" to activate
tell application "System Events"
repeat while (name of first application process whose frontmost is true) is not "alacritty"
delay 0.05
end repeat
set _alacritty to first application process whose frontmost is true
-- If Alacritty was running, create a new window to run command
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active November 20, 2024 01:24
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active November 18, 2024 19:17
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@gaearon
gaearon / reducers.js
Last active December 11, 2020 14:56
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@jpetitcolas
jpetitcolas / gist:5967887
Created July 10, 2013 16:37
Encode/decode a base64 encoded string in PostGreSQL
-- Decoding
SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table;
-- Encoding
SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table;
@zdk
zdk / extract_youtube_id.mm
Created January 8, 2013 06:38
A stupid Regex to extract Youtube id from the given list of youtube URLs in Objective-C
//
// extract_youtube_id.m
// TestRegex
//
// Created by zdk on 1/8/2013 BE.
// Copyright (c) 2013 zdk. All rights reserved.
//
#import <Foundation/Foundation.h>
@xlarsx
xlarsx / gist:948788
Created April 29, 2011 18:43
QT Transformation Widget
## Ref: http://www.qtcentre.org/threads/27130-Rotate-QGraphicsProxyWidget-in-QGraphicsView
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGraphicsView gv;
QGraphicsScene scene(-200,-200,400,400);
gv.setScene(&scene);