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
@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 May 22, 2024 19:02
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 May 22, 2024 07:55
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
});
@robphoenix
robphoenix / spacemacs-cheshe.md
Last active February 6, 2024 23:11
[DEPRECATED] Spacemacs Cheat Sheet - Visit https://github.com/Ben-PH/spacemacs-cheatsheet

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);
@xlarsx
xlarsx / Apuntes Clojure.txt
Created March 8, 2011 17:01
Notas de Clojure
=> def - Definición de un macro
Ejemplo:
(def nomSimbolo "Texto")
=> ns - Definición de una namespace
Ejemplo:
(ns namespace1)
Variantes:
:use - Importa al namespace otro namespace
Ejemplo: