Skip to content

Instantly share code, notes, and snippets.

@mtigas
mtigas / gist:952344
Last active June 20, 2024 11:22
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:

@yobud
yobud / AddFulltextIndexesCommand.php
Created September 22, 2011 09:35
MATCH AGAINST for Doctrine DQL queries
<?php
# xxx/yyyBundle/Command/AddFulltextIndexesCommand.php
/**
* AddFulltextIndexesCommand.php
*
* @author Jérémy Hubert <jeremy.hubert@infogroom.fr>
* @since lun. 26 sept. 2011 09:23:53
*/
namespace xxx\yyyBundle\Command;
@joshellington
joshellington / sftp-ubuntu.md
Created March 28, 2012 07:07
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@kapkaev
kapkaev / gist:4619127
Created January 24, 2013 09:30
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@stantonk
stantonk / flake8.xml
Created January 26, 2013 01:17
PyCharm Flake8 Configuration XML File
<!-- Drop this in ~/Library/Preferences/PyCharm20/tools -->
<!-- make sure you set the path to flake8 executable for your machine in the COMMAND option -->
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Flake8">
<tool name="Flake8 File" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="/usr/local/share/python/flake8" />
<option name="PARAMETERS" value="--max-line-length=120 --ignore=E301,E302,E261,E262,W404 $FileDir$/$FileName$" />
<option name="WORKING_DIRECTORY" value="$FileDir$" />
@ecarreras
ecarreras / idle.py
Created August 14, 2013 12:22
Play music only on activity
#!/usr/bin/env python
import ctypes
import os
import time
import sys
class XScreenSaverInfo(ctypes.Structure):
""" typedef struct { ... } XScreenSaverInfo; """
_fields_ = [('window', ctypes.c_ulong), # screen saver window
('state', ctypes.c_int), # off,on,disabled
@ecarreras
ecarreras / perms_dump.sql
Last active December 22, 2015 07:08
permisos taules forànies
SELECT
'access_' || replace(m.model, '.', '_') as id,
m.model as name, md.module ||'.'||'model_' || replace(m.model, '.', '_') as "model_id:id",
coalesce(gd.module ||'.', '') || g.name as "group_id:id",
a.perm_read::int as perm_read,
a.perm_write::int as perm_write,
a.perm_create::int as perm_create,
a.perm_unlink::int as perm_unlink
FROM
ir_model_access a
@sloria
sloria / bobp-python.md
Last active July 7, 2024 18:13
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@favila
favila / git-squash.sh
Created February 24, 2014 05:40
git-squash: script to create a squashed patch from a branch.
#! /bin/sh
# Produce a squash-commit patch from a branch of changes
MASTER=$1
PATCHBRANCH=$2
SQUASHBRANCH="$PATCHBRANCH-squash"
MESSAGE=$3
git checkout -b $SQUASHBRANCH $MASTER &&
git merge --squash $PATCHBRANCH &&
git commit -a -m "$MESSAGE" &&