Skip to content

Instantly share code, notes, and snippets.

View Merovex's full-sized avatar

Ben W Merovex

  • Gainfully Employed
  • In a hidden bunker under a non-descript building
  • 23:31 (UTC -04:00)
View GitHub Profile
@Merovex
Merovex / README.md
Last active August 29, 2015 14:13 — forked from magnetikonline/README.md

Create favicon.ico from PNG source using ImageMagick

Using a source PNG image with dimensions of 144x144, which will be our apple-touch-icon used for Apple iOS and tablet devices.

$ convert -resize 32x32 -colors 256 favicon.png favicon.ico

Markup for HTML page <head> area:

@Merovex
Merovex / ScrivenerProgress Crontab
Last active December 26, 2015 19:11
Parse a Scrivener Project for daily progress
# <PreviousSession Words="1" Characters="0" Date="2015-12-25 10:05:50 -0500"></PreviousSession>
59 23 * * * /usr/bin/grep PreviousSession /path/to/project.scriv/*.scrivx >> /path/to/writing.log
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>bcwi.updateWordCount</string>
<key>UserName</key>
<string>bwilson</string>
<key>WorkingDirectory</key>
<string>/path/to/project.scriv/</string>
#!/bin/sh
# 0 */2 * * * /path/to/gitAutoPush.sh >> /path/to/auto-push.log 2>&1
DATE=`date -u`
echo "==== $DATE ===="
cd /path/to/project.scriv/
git add . -A
git commit -am "Automated Snapshot - $DATE";
git push origin master
#!/path/to/bin/ruby
Encoding.default_external = Encoding::UTF_8 # Stops LaunchD from carping
Encoding.default_internal = Encoding::UTF_8 # Ditto
require 'rubygems'
require 'json'
require 'date'
require "pathname"
require "erb"
require "yaml"
@Merovex
Merovex / git-wars.md
Created October 15, 2016 16:01 — forked from juderosen/git-wars.md
Git Wars: GitHub vs Bitbucket

Git Wars: GitHub vs Bitbucket

Introduction

Now, you might think the answer I'm going to give you is already obvious because I'm using GiHub right now, but it's not. Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans. In the following... thing, I'm going to compare the two and then offer a final solution that should work for most people.

TL;DR: Both. Use GitHub for open source and public repos (you'll spend most of your time here) and Bitbucket for private repos. But, sign up for GitHub first, then import account into Bitbucket. Also, check comments for updates. P.S. I personally prefer GitHub.

Interface and Functionality

@Merovex
Merovex / gist:16b584a1cfab090d2b81fefb14987ed7
Created December 2, 2016 02:06 — forked from kaizhu256/gist:4482069
javascript - very fast and simple uuid4 generator benchmarked on http://jsperf.com/uuid4/8
/*jslint bitwise: true, indent: 2, nomen: true, regexp: true, stupid: true*/
(function () {
'use strict';
var exports = {};
exports.uuid4 = function () {
//// return uuid of form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
var uuid = '', ii;
for (ii = 0; ii < 32; ii += 1) {
@Merovex
Merovex / auto-commit.rb
Last active April 2, 2017 13:55
Auto Commit Git repo to GitHub
#!/bin/ruby
File.read("/PATH-TO/.auto-commit").split("\n").each do |dir|
Dir.chdir(dir)
next if `find . -newer .last-mod`.split("\n").empty? # No change to file system
puts "### #{Time.new.strftime("%Y-%m-%d %H:%M:%S")} (#{dir}) ###"
`git pull origin $(git symbolic-ref HEAD | cut -d'/' -f3)`
`git add . -A`
@Merovex
Merovex / config.yml
Created October 9, 2017 15:06 — forked from retrage/config.yml
config.yml for Latex on Circle CI 2.0
version: 2
jobs:
build:
docker:
- image: paperist/alpine-texlive-ja
steps:
- run:
name: Installing dependancies
command: |
apk add --update git patch curl
PATH=$PATH:/usr/local/bin:/usr/local/sbin
#!/bin/bash
gitbranch=`git rev-parse --abbrev-ref HEAD`
if [ $gitbranch = "master" ]; then
date=`date +%m/%d/%Y`
datetime=`date +%r`
gitwa=`git diff HEAD^ HEAD --word-diff=porcelain | grep -e "^+[^+]" | wc -w`
gitwd=`git diff HEAD^ HEAD --word-diff=porcelain | grep -e "^-[^-]" | wc -w`
commit=`git log -1 --pretty=%B`
cnt=`expr $gitwa - $gitwd`