diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`
where XXXXX
is the size of the RAM disk in terms of memory blocks.
Notes:
#!/bin/bash | |
# Run as if it was called from cron, that is to say: | |
# * with a modified environment | |
# * with a specific shell, which may or may not be bash | |
# * without an attached input terminal | |
# * in a non-interactive shell | |
# This scripts supports cron jobs run by any user, just run it as the target user (e.g. using sudo -u <username>) | |
# An up-to-date version of this script may be available at https://github.com/daladim/run-as-cron |
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.impl.client.HttpClientBuilder; | |
import org.apache.http.util.EntityUtils; | |
import org.junit.Test; | |
import java.io.IOException; | |
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath; |
A brief tour of all the properties and methods in the pathlib
module.
The pathlib
module is part of the Python stardard library (as of v. 3.4) and can be used can do file handling tasks previously done by multiple libraries. Instead of using mere strings to represent filepaths, pathlib
uses objects that have many useful properties and methods.
For example, pathlib
can replace (amongst others):
os
- .rename()
, .sep()
, .walk()
, .chmod()
, .mkdir()
, .stat()
os.path
- .join()
, .split()
, .exists()
, .basename()
#!/bin/bash | |
# requires jq | |
# arg 1: iCloud web album URL | |
# arg 2: folder to download into (optional) | |
function curl_post_json { | |
curl -sH "Content-Type: application/json" -X POST -d "@-" "$@" | |
} |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python (Updated for Python 3.7) | |
Usage: | |
./dummy-web-server.py -h | |
./dummy-web-server.py -l localhost -p 8000 | |
Send a GET request: |