Skip to content

Instantly share code, notes, and snippets.

Avatar
🤺
Programming

José Aguirre josejaguirre

🤺
Programming
View GitHub Profile
@mtigas
mtigas / gist:952344
Last active Sep 15, 2022
Mini tutorial for configuring client-side SSL certificates.
View gist:952344

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@insin
insin / bash_prompt.sh
Created Dec 3, 2011 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
View bash_prompt.sh
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@qiao
qiao / ip.js
Created Jan 17, 2012
Node.js get client IP address
View ip.js
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');
@onpubcom
onpubcom / onpubcom_array_date_sort.js
Created Feb 8, 2012
How to Sort an Array of Dates with JavaScript
View onpubcom_array_date_sort.js
<script type="text/javascript">
// First let's create an array of JavaScript Date
// objects.
// More info about the Date class:
// http://w3schools.com/js/js_obj_date.asp
var dates = [
new Date(2010, 4, 10, 10, 07, 16),
new Date(2010, 4, 8, 9, 16, 09),
new Date(2010, 3, 30, 0, 15, 49),
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@cam-gists
cam-gists / fgc.php
Created Jul 2, 2012
PHP: file_get_contents vs. cURL
View fgc.php
<?php
$html = file_get_contents("http://example.com/product/42");
$context = stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Content-Type: multipart/form-data; boundary=--foo\r\n",
"content" => "--foo\r\n"
. "Content-Disposition: form-data; name=\"myFile\"; filename=\"image.jpg\"\r\n"
. "Content-Type: image/jpeg\r\n\r\n"
@sofa420
sofa420 / fabfile.py
Created Jul 30, 2012 — forked from kmpm/fabfile.py
Fabric deployment of Node.js on Ubuntu
View fabfile.py
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@renyi
renyi / managers.py
Created Aug 18, 2012
Simple Geo model for Django
View managers.py
from geopy import units, distance
from mezzanine.core.managers import CurrentSiteManager
class GeoManager(CurrentSiteManager):
def near(self, latitude=None, longitude=None, distance_range=30):
queryset = super(GeoManager, self).get_query_set()
if not (latitude and longitude and distance_range):
return queryset.none()
@iros
iros / API.md
Created Aug 22, 2012
Documenting your REST API
View API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@setola
setola / functions.php
Last active Sep 25, 2020 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown n-levels menus in Wordpress.
View functions.php
<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
*/
class BootstrapNavMenuWalker extends Walker_Nav_Menu {