This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from wordpress_xmlrpc import Client, WordPressPost | |
from wordpress_xmlrpc.methods.posts import GetPosts, GetPost | |
wp = Client('https://yoursiteaddress.com/xmlrpc.php', 'username', 'password') # update the site address, username and password | |
# retrives the list of all posts in the blog. Optional: you can supply filters and fields to sort by. | |
print(wp.call(GetPosts({'post_status': 'publish'}))) | |
# retrives a single post in the blog. Required: postId. Optional: fields | |
# pass in postId when running this script, e.g python wp.py 1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"image" | |
gcolor "image/color" | |
"image/draw" | |
"github.com/go-playground/colors" | |
) | |
func redrawImage(imgBytes []byte) error { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert JPG to PDF | |
gs -sPAPERSIZE=a4 -sDEVICE=pdfwrite -o output.pdf /usr/share/ghostscript/9.27/lib/viewjpeg.ps -c "(input.jpg) viewJPEG" | |
# Convert PDF to JPG | |
gs -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300 -o output.jpg input.pdf | |
# Convert PDF to JPG, only 1st page | |
gs -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1 -r300 -o output.jpg input.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"aws_access_key": "", | |
"aws_secret_key": "" | |
}, | |
"builders": [{ | |
"type": "amazon-ebs", | |
"access_key": "{{user `aws_access_key`}}", | |
"secret_key": "{{user `aws_secret_key`}}", | |
"region": "ap-southeast-1", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap 'echo "Wait for the script to finish"' SIGINT SIGTERM EXIT | |
# Recurses a directory to do git pulls in each repo folder | |
BASEDIR=/Users/test/go/src/github.com | |
for dir in "$BASEDIR"/* | |
do | |
if [[ -d "$dir" ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g mouse on | |
set -g @plugin 'jimeh/tmux-themepack' | |
set -g @themepack 'basic' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
set -g @plugin 'tmux-plugins/tmux-prefix-highlight' | |
run '~/.tmux/plugins/tpm/tpm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keystone = require('keystone'); | |
var express = require('express'); | |
var body = require('body-parser'); | |
var helmet = require('helmet'); | |
var app = express(); | |
app.use(body.urlencoded({ extended: false })); | |
app.use(body.json()); | |
app.use(helmet()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var should = require('should'); | |
var Invitations = require('./Invitations'); | |
describe('Customers to invite to office', function () { | |
var invite; | |
beforeEach(function () { | |
invite = new Invitations(53.3381985, -6.2592576); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import Base from 'ember-simple-auth-token/authenticators/token'; | |
export default Base.extend({ | |
authenticate(credentials, headers) { | |
return new Ember.RSVP.Promise((resolve, reject) => { | |
const data = this.getAuthenticateData(credentials); | |
this.makeRequest(data, headers).then(response => { | |
if (response.data && response.data.role === 'admin') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gspread | |
from oauth2client.service_account import ServiceAccountCredentials | |
SCOPE = ['https://spreadsheets.google.com/feeds'] | |
# The key file can be downloaded from Google Developer Console | |
KEY = 'yourkey.json' | |
# Authenticate using your key file | |
credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY, SCOPE) |
NewerOlder