Skip to content

Instantly share code, notes, and snippets.

View matthewpalmer's full-sized avatar

Matthew Palmer matthewpalmer

View GitHub Profile
nfs ⟩ kubectl exec -it pod-using-nfs sh
/ # cat /var/nfs/dates.txt
Mon Oct 22 00:47:36 UTC 2018
Mon Oct 22 00:47:41 UTC 2018
Mon Oct 22 00:47:46 UTC 2018
nfs ⟩ kubectl exec -it nfs-server-pod sh
# cat /exports/dates.txt
@matthewpalmer
matthewpalmer / nfs-server.yaml
Created October 22, 2018 00:40
Kubernetes NFS server
# Note - an NFS server isn't really a Kubernetes
# concept. We're just creating it in Kubernetes
# for illustration and convenience. In practice,
# it might be run in some other system.
# Create a service to expose the NFS server
# to pods inside the cluster.
kind: Service
apiVersion: v1
@matthewpalmer
matthewpalmer / hello.php
Created July 21, 2018 04:06
php hello world
<html>
<head>
<title>PHP Hello World!</title>
</head>
<body>
<?php echo '<h1>Hello World</h1>'; ?>
<?php phpinfo(); ?>
</body>
</html>
@matthewpalmer
matthewpalmer / gist:7836472
Created December 7, 2013 02:05
full auto linked tumblr post ia writer
on displayErrorMessage(s)
display dialog (s) buttons {"OK"} default button "OK" with icon caution
end displayErrorMessage
tell application "Safari"
try
# Get the URL, title and selected text of the frontmost page
set pageURL to URL of document 1
set pageTitle to name of document 1
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
@matthewpalmer
matthewpalmer / gist:7836424
Last active December 30, 2015 13:29
New linked post for tumblr in ia writer
on displayErrorMessage(s)
display dialog (s) buttons {"OK"} default button "OK" with icon caution
end displayErrorMessage
tell application "Safari"
try
# Get the URL, title and selected text of the frontmost page
set pageURL to URL of document 1
set pageTitle to name of document 1
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
@matthewpalmer
matthewpalmer / gist:7836328
Created December 7, 2013 01:49
Automatically post to tumblr from iA Writer
# The file we are using is the frontmost one in iA Writer
# Returns the location of the file
set the_file to get file of front document of application "iA Writer"
# Get the contents of the file
set the_initial_text to (do shell script "cat " & quoted form of (POSIX path of the_file))
# Set the title to the filename
set the_title to get name of front document of application "iA Writer"
@matthewpalmer
matthewpalmer / gist:7271965
Created November 1, 2013 21:07
--save-dev
bower install angular --save-dev
@matthewpalmer
matthewpalmer / gist:7262751
Created November 1, 2013 09:02
Tab past closing brackets in sublime text 2
{ "keys": ["enter"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)\"\\]]", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
}
@matthewpalmer
matthewpalmer / index.js
Created May 12, 2013 05:56
List all the items in a remote mongodb database
var MongoClient = require('mongodb').MongoClient;
function get(callback) {
MongoClient.connect('DBURL', function(err, db) {
var collection = db.collection('users');
var cursor = collection.find({});
cursor.each(function(a,b) {
console.log('response:', a, b);
});
@matthewpalmer
matthewpalmer / terminalcommands.md
Last active December 17, 2015 05:39
Useful Terminal commands I can't remember

Curl

Use postdata npm module to extract the post data on the server. Use -k for https, -u for auth.

curl --data "param1=value1&param2=value2" https://localhost:3000/user/re
curl --data "param1=value1&param2=value2" -k -X POST https://localhost:3000/user/re
curl --form "fileupload=@filename.txt" https://localhost:3000/user/re
curl -u myusername:mypassword http://somesite.com

Git