Skip to content

Instantly share code, notes, and snippets.

@codebrane
codebrane / style.css
Created February 5, 2022 14:01
Genesis child theme stylesheet
/*
Theme Name: Gabbro
Theme URI: https://demo.studiopress.com/
Description: This is the sample theme created for the Genesis Framework.
Author: StudioPress
Author URI: https://www.studiopress.com/
Version: 1.0.0
Tags: accessibility-ready, block-styles, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, left-sidebar, one-column, right-sidebar, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, two-columns, wide-blocks
<!DOCTYPE html>
<html lang="en-GB">
<head >
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Blog</title>
<meta name='robots' content='max-image-preview:large' />
<link rel='dns-prefetch' href='//fonts.googleapis.com' />
<link rel='dns-prefetch' href='//s.w.org' />
@codebrane
codebrane / pipic.rb
Created August 3, 2013 10:03
Taking a picture with the Raspberry Pi camera and uploading it to Dropbox
require 'dropbox_sdk'
file = File.open('access_token', "rb")
access_token = file.read
client = DropboxClient.new(access_token)
puts "taking picture..."
system('raspistill -o camera_image.jpg')
@codebrane
codebrane / pipic_setup.rb
Created August 3, 2013 09:56
Setup Dropbox access from Ruby
require 'dropbox_sdk'
APP_KEY = 'YOUR_APP_KEY'
APP_SECRET = 'YOUR_APP_SECRET'
flow = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET)
authorize_url = flow.start()
puts '1. Go to: ' + authorize_url
puts '2. Click "Allow" (you might have to log in first)'
puts '3. Copy the authorization code'
@codebrane
codebrane / grep output
Created June 8, 2013 06:39
wordpress post via grep
<title>Coffee break Shibboleth IdP install with custom certificate, login page and LDAP</title>
<link>http://codebrane.com/blog/?p=2899</link>
<pubDate>Thu, 07 Feb 2013 09:05:08 +0000</pubDate>
@codebrane
codebrane / migratr.rb
Last active December 18, 2015 05:39
Change wordpress post links with octocpress post links
require 'time'
SLUG_TITLE = 0
LINK = 1
DATE = 2
FIND_WP_POST_LINKS = 'grep "http://codebrane.com/blog/?p=" /Users/alistair/dev/codebrane/codebrane.com/codebrane.com.octopress/source/_posts/*'
FIND_WP_POST_IN_EXPORT = 'grep -C 1 "<link>http://codebrane.com/blog/?p=__POST_ID__</link>" ../codebrane.com.wp.export/codebraneblog.wordpress.2013-06-23.xml'
FAR = "find /Users/alistair/dev/codebrane/codebrane.com/codebrane.com.octopress/source/_posts/ -type f | xargs perl -pi -e 's/http:\\/\\/codebrane.com\\/blog\\/\\?p=__WP_POST_ID__\"/__OCTOPRESS_LINK__\"/g'"
@codebrane
codebrane / Rakefile
Created June 8, 2013 06:17
lftp configuration for octopress
ftp_user = "username"
ftp_server = "codebrane.com"
ftp_target = "/remote/path/to/blogocto"
deploy_default = "lftp"
desc "Deploy website via LFTP"
task :lftp do
puts "## Deploying website via LFTP"
ok_failed system("lftp -e 'set ftp:ssl-allow off; set ssl:verify-certificate no; mirror -R --ignore-time --delete -v #{public_dir} #{ftp_target}; bye' -u #{ftp_user} #{ftp_server}")
end
export CXXFLAGS="-O0 -Wall -fno-exceptions -fno-rtti -fno-implement-inlines"
export LDFLAGS="-Xlinker -search_paths_first -L/Users/alistair/apps/readline-6.2/lib"
export CPPFLAGS="-I/Users/alistair/apps/readline-6.2/include"
./configure --prefix=/Users/alistair/apps/lftp-4.4.8 \
--with-openssl \
--disable-shared \
--disable-nls
make
make install
export MACOSX_DEPLOYMENT_TARGET=10.5
export CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
export CCFLAGS="-arch x86_64 -g -Os -pipe"
export CXXFLAGS="-arch x86_64 -g -Os -pipe"
export LDFLAGS="-arch x86_64 -bind_at_load"
./configure --prefix=/Users/alistair/apps/readline-6.2 \
--enable-shared
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
@codebrane
codebrane / configure_pkgconfig.sh
Created June 8, 2013 06:13
compile pkg_config
export LDFLAGS=-L/Users/alistair/apps/gettext-0.18.2/lib
export CPPFLAGS=-I/Users/alistair/apps/gettext-0.18.2/include
export PATH="/Users/alistair/apps/gettext-0.18.2/bin:$PATH"
./configure --prefix=/Users/alistair/apps/pkg-config-0.27 \
--with-internal-glib
make
make install