Skip to content

Instantly share code, notes, and snippets.

@ishikawa
ishikawa / gist:88599
Created April 1, 2009 07:49
Java Sample Code for Calculating HMAC-SHA1 Signatures
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@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:
@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);
@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>
@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;

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
@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
});
@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.
@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

@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