Skip to content

Instantly share code, notes, and snippets.

@schollz
schollz / public_key_decrypt_gpg_base64.go
Created March 11, 2016 03:43 — forked from jyap808/public_key_decrypt_gpg_base64.go
Decrypting a base64 GPG public key encrypted string using a passphrase protected private key in ASCII armor format
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
)
@augustohp
augustohp / custom-respect-validation-rules.md
Last active March 24, 2022 17:24
How to create custom Respect\Validation rules.

Custom rules on Respect/Validation

You may not know that [the most awesome validation engine for PHP][1] out there is [Respect/Validation][2]. If you do, this is tailored for you!

All rules on [Respect/Validation][2] are meant to be used together, composing a more complex validation rule that is closer to the domain of your application than the existing ones, let's try an example:

@tamoyal
tamoyal / gist:10441108
Created April 11, 2014 04:39
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@vratiu
vratiu / .bash_aliases
Last active May 29, 2024 12:23
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@jeremygibbs
jeremygibbs / wp2sc.py
Created January 31, 2012 10:22 — forked from Reiot/wordpress2octopress.py
WordPress XML ==> Second Crack Markdown
#!/usr/bin/env python
#######################################################
# File: wp2sc.py #
# Date: 31 January 2011 #
# Auth: Jeremy A. Gibbs #
# Depn: Requires BeautifulSoup and html2text #
# Desc: This script reads in a Wordpress .xml export #
# file and converts the contents into markdown #
# formatted files suitable to import into #
# Marco Arment's Second Crack static blogging #