@ wrote... (5 years, 11 months ago)

The curl manpage isn't super clear on this, but to read from stdin you need to prepend the dash with a @.

json_producer | curl -d @- -H 'Content-Type: application/json' http://example.com/json_consumer
Category: tech, Tags: linux, shell
Comments: 0
@ wrote... (6 years ago)

Uploading to Minio (or S3) in a script is a bit tricky.

Update: now on GitHub with some Python versions.


# usage: ./minio-upload my-bucket my-file.zip


s3_key='secret key'
s3_secret='secret token'

date=`date -R`
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64`

curl -v -X PUT -T "${file}" \
          -H "Host: $host" \
          -H "Date: ${date}" \
          -H "Content-Type: ${content_type}" \
          -H "Authorization: AWS ${s3_key}:${signature}" \
Category: tech, Tags: linux, python, shell
Comments: 2
@ wrote... (7 years, 2 months ago)

At work we have a large project that is comprised of several nested git repos so having your bash prompt get updated with some vital information such as repo, branch, etc makes life much easier.

Here's an example of my prompt and how it shows the current git repo:

[kurt@machine-1 ~/src/foo/bar/baz venv:foo git:bug_branch repo:bar]


Category: tech, Tags: shell
Comments: 1
@ wrote... (8 years, 9 months ago)

I often want to make a directory and then immediately cd into that directory.

mkdir foo
cd foo

put the following in your .bashrc

function mcd()
    mkdir $*
    cd ${args[@]:(-1)}

and then

source ~/.bashrc
mcd -p a/b/c/d
Category: tech, Tags: shell
Comments: 0
@ wrote... (10 years, 10 months ago)

This was originally the majority of this post: Start a django project the right way but I've decided to put in it's own post instead.

I'm assuming you're on OSX. If you're on Linux most of these steps will be the same. If you're on Windows… Install VMWare and then install Linux.

I've added a tl;dr at the end.

Although I have tweaked this over the years, the original code came from (I think, I've long since lost the bookmark) klymyshyn.com


Category: tech, Tags: python, shell
Comments: 10
@ wrote... (12 years, 3 months ago)

Based off of a script by Adam Pierce. Mine is a little more user friendly.

Get latest version here.


Category: tech, Tags: shell
Comments: 0
@ wrote... (16 years ago)

Some useful Linux commands.


Category: tech, Tags: linux, shell
Comments: 0