Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
DmitrySoshnikov / infix-to-postfix-regexp.js
Created September 24, 2011 20:14
Infix to postfix notation RegExp converter
/**
* Infix to postfix notation RegExp converter
*
* To implement RegExp machine (NFA, DFA) we need
* to transform first RegExp string to postfix notation
* for more convinient work with the stack. This function
* does exactly this.
*
* See: http://swtch.com/~rsc/regexp/regexp1.html
*
@bortzmeyer
bortzmeyer / gist:1284249
Created October 13, 2011 13:42
The only simple way to do SSH in Python today is to use subprocess + OpenSSH...
#!/usr/bin/python
# All SSH libraries for Python are junk (2011-10-13).
# Too low-level (libssh2), too buggy (paramiko), too complicated
# (both), too poor in features (no use of the agent, for instance)
# Here is the right solution today:
import subprocess
import sys
@waylan
waylan / subprocess_pipe.md
Created April 10, 2012 19:12
Writing to a python subprocess pipe

Here's a few things I tried to write output to a python subprocess pipe.

from subprocess import Popen, PIPE

p = Popen('less', stdin=PIPE)
for x in xrange(100):
    p.communicate('Line number %d.\n' % x)
@n8foo
n8foo / ec2-metadata.sh
Created May 29, 2012 21:45
ec2-metadata
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
@cnicodeme
cnicodeme / server.sh
Last active June 30, 2019 00:36
This script automatically set up a new *Debian* server with Apache, Mysql, Php and ProFTPd, and secures all of the previous + SSH.
#!/bin/bash
#
# --------------------------------------------------------------------
# This is a free shell script under GNU GPL version 3.0 or above
# Copyright (C) 2005 ReFlectiv project.
# Feedback/comment/suggestions : http://www.reflectiv.net/
# -------------------------------------------------------------------------
#
# This script automatically set up a new *Debian* server (IMPORTANT : Debian!), by doing these actions :
#
@pascalpoitras
pascalpoitras / 1.md
Last active March 3, 2025 13:44
My WeeChat configuration

This configuration is not maintained anymore. You should think twice before using it, Breaking change and security issue will likely eventually happens as any abandonned project.

@soarez
soarez / ca.md
Last active March 8, 2025 21:38
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@bsweger
bsweger / useful_pandas_snippets.md
Last active January 12, 2025 13:54
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@justinhennessy
justinhennessy / gist:28e82c2ec05f9081786a
Last active April 29, 2021 23:13
Parsing JSON with Ansible ...

Recently, Everyday Hero has been doing a heap of work around the automation and provisioning of resources with AWS cloud services. This entails working frequently with the AWS API.

A useful filter we have been using in Ansible is taking output from a shell action and turning it into something we can consume via variables.

An example playbook is below: