Skip to content

Instantly share code, notes, and snippets.

View josejaguirre's full-sized avatar
🤺
Programming

José Aguirre josejaguirre

🤺
Programming
View GitHub Profile
@mtigas
mtigas / gist:952344
Last active April 3, 2024 07:57
Mini tutorial for configuring client-side SSL certificates.

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 December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/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 January 17, 2012 11:27
Node.js get client IP address
// 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 February 8, 2012 20:15
How to Sort an Array of Dates with JavaScript
<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),
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 25, 2024 06:23
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@cam-gists
cam-gists / fgc.php
Created July 2, 2012 19:47
PHP: file_get_contents vs. cURL
<?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 July 30, 2012 17:55 — forked from kmpm/fabfile.py
Fabric deployment of Node.js on Ubuntu
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 August 18, 2012 07:34
Simple Geo model for Django
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 August 22, 2012 14:42
Documenting your REST API

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 September 25, 2020 18:29 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown n-levels menus in Wordpress.
<?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 {