Skip to content

Instantly share code, notes, and snippets.

@chagel
chagel / Rakefile
Created November 28, 2011 09:11
Rakefile to manage jekyll commands
desc 'Begin a new post'
task :post do
ROOT_DIR = File.dirname(__FILE__)
title = ARGV[1]
tags = ARGV[2 ]
unless title
puts %{Usage: rake post "The Post Title"}
exit(-1)
@chagel
chagel / gist:5693675
Created June 2, 2013 13:36
Sync Google+ to Twitter, including post/photo/article sharing etc.
require 'google_plus'
require 'twitter'
require 'time'
require 'open-uri'
GooglePlus.api_key = '111'
UID = 111
Twitter.configure do |config|
config.consumer_key = '111'
@chagel
chagel / export_to_ghost.rb
Created January 17, 2014 14:25
Ruby script to export Jekyll & Octopress posts for Ghost
#encoding: utf-8
require 'json'
require 'yaml'
require 'active_support/core_ext'
I18n.enforce_available_locales = false
export_data = {
meta: {
version: "000"
@chagel
chagel / god-service
Created January 17, 2014 14:32
God & Resque Pool scripts
#!/bin/bash
#
# god Startup script for god (http://god.rubyforge.org)
#
# chkconfig: - 85 15
# description: God is an easy to configure, easy to extend monitoring \
# framework written in Ruby.
#
CONF_DIR=/etc/god
@chagel
chagel / gist:9ad5f799ec5801cd1335
Created July 8, 2014 06:38
Generate iOS icon assets
#Generate all iOS icon assets from one big PNG file
source_icon='icon-1024-01.png'
generated_folder='generated'
sizes=(29 40 50 57 58 72 76 80 100 114 120 144 152)
mkdir -p $generated_folder
for size in ${sizes[*]}
do
sips -Z $size --out $generated_folder/Icon-$size.png $source_icon
done
@chagel
chagel / gist:3a093dcf4f398f8c8135
Created July 8, 2014 07:23
Generate Android icon assets
#Generate different icon sizes for Android - ldpi/mdpi/hdpi/xhdpi
source_icon='icon-1024-01.png'
generated_folder='generated-android'
mkdir -p $generated_folder
mkdir -p $generated_folder/drawable-ldpi
mkdir -p $generated_folder/drawable-mdpi
mkdir -p $generated_folder/drawable-hdpi
mkdir -p $generated_folder/drawable-xhdpi
@chagel
chagel / gist:c17e0e5eb2e55662a0c4
Last active October 23, 2019 03:59
Generate icon set(*.icns) from png
mkdir icon.iconset
sips -z 16 16 icon.png --out icon.iconset/icon_16x16.png
sips -z 32 32 icon.png --out icon.iconset/icon_16x16@2x.png
sips -z 32 32 icon.png --out icon.iconset/icon_32x32.png
sips -z 64 64 icon.png --out icon.iconset/icon_32x32@2x.png
sips -z 128 128 icon.png --out icon.iconset/icon_128x128.png
sips -z 256 256 icon.png --out icon.iconset/icon_128x128@2x.png
sips -z 256 256 icon.png --out icon.iconset/icon_256x256.png
sips -z 512 512 icon.png --out icon.iconset/icon_256x256@2x.png
@chagel
chagel / slack_delete.rb
Created March 1, 2018 14:01 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@chagel
chagel / dmv.js
Created July 26, 2018 22:30
DRY DMV
const OFFICE_ID = "632" //santa clara, sanjose=516
const FIRST_NAME = ""
const LAST_NAME = ""
const PHONE_AREA = ""
const PHONE_PREFIX = ""
const PHONE_SUFFIX = ""
const { Chromeless } = require('chromeless')
async function run() {
@chagel
chagel / irc.md
Created November 25, 2018 00:40 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.