<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blogs on Gmarik Info</title><link>https://www.gmarik.info/blog/</link><description>Recent content in Blogs on Gmarik Info</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 14 Feb 2021 22:48:46 -0800</lastBuildDate><atom:link href="https://www.gmarik.info/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>Nand2Tetris part-II review</title><link>https://www.gmarik.info/blog/2021/nand2tetris-part-2-review/</link><pubDate>Sun, 14 Feb 2021 22:48:46 -0800</pubDate><guid>https://www.gmarik.info/blog/2021/nand2tetris-part-2-review/</guid><description>If you ever wanted to improve your understanding of a computer system or write a compiler then this post may convince you to take the course or read the book.
TLDR Cons Hack platform is an educational platform, so learnings aren’t directly applicable in “real world” (see Pros tho) provided software is somewhat rough at times with unclear and hard to debug errors Jack OS is not what many people may expect, it’s a mix of Jack standard library (Array, String) and HW drivers (Memory, Keyboard, Output, Screen) Pros the only course(AFAIK) with such a depth: from NAND gates to the OS(requires part I) learning are transferrable to the “real world” platforms to some degree introduces concept of the Stack Machines introduces Virtual Machines and VM instructions introduces concepts of high-level programming languages introduces to Syntax and Formal Grammars teaches how to implement Hack assembler teaches how to implement Jack Lexer teaches how to implement Jack Parser teaches how to implement Jack Compiler teaches how to program in Jack teaches how to implement memory allocator as part of Jack OS teaches how to implement Strings and Arrays teaches how to deal with IO and build Jack OS Week 1: Machine language and Stack Arithmetic Is a warmup week and a refresher on the Hack HW platform and Assembly in the first half.</description></item><item><title>Quines</title><link>https://www.gmarik.info/blog/2020/understanding-quines/</link><pubDate>Fri, 24 Jul 2020 15:13:55 -0700</pubDate><guid>https://www.gmarik.info/blog/2020/understanding-quines/</guid><description>In Trusting Trust paper, Ken Thompson touched several ideas that made me think.
STAGE I
…
to write a source program that, when compiled and executed, will produce as output an exact copy of its source. If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it.</description></item><item><title>Glob matching</title><link>https://www.gmarik.info/blog/2020/understanding-glob-matching/</link><pubDate>Sun, 05 Jul 2020 14:41:05 -0700</pubDate><guid>https://www.gmarik.info/blog/2020/understanding-glob-matching/</guid><description>Motivation Understanding what is glob and how glob matching operates will help you adopt this useful mini-language in your domain whether you&amp;rsquo;re a user, programmer, or an architect.
What is glob? Long ago, in UNIX V6, there was a program /etc/glob that would expand wildcard patterns. Soon afterward this became a shell built-in.
&amp;mdash; glob(7) — Linux manual page
Glob, short for global, is many things:
a DSL to describe text patterns a library function a unix command having multiple meaning and such a generic name, not surprisingly, leads to the confusion.</description></item><item><title>Technical Writing One: Notes</title><link>https://www.gmarik.info/blog/2020/technical-writing-one-notes/</link><pubDate>Sat, 16 May 2020 14:09:09 +0000</pubDate><guid>https://www.gmarik.info/blog/2020/technical-writing-one-notes/</guid><description>Do you want to improve your technical writing? Google Developers were kind enough to publish Technical Writing One so there are no more excuses to not get better at it.
The course takes ~2 hours to finish and it&amp;rsquo;ll immediately improve your writing.
The course is so polished that the table of contents serves as &amp;ldquo;fast and hard rules&amp;rdquo; index which I decided to turn into a blog post of my own, for a quick reference.</description></item><item><title>SRE Course: part 01: abstract</title><link>https://www.gmarik.info/blog/2019/sre-course-part-01-abstract/</link><pubDate>Fri, 06 Dec 2019 18:22:26 -0800</pubDate><guid>https://www.gmarik.info/blog/2019/sre-course-part-01-abstract/</guid><description>.sli {color: brown} .slo {color: blue} .sla {color: green} .eb {color: purple} .eb, .sli, .slo, .sla, .eb { font-weight: 800; font-style: normal; } Just finished the SRE course and thought I need to capture my thoughts both directly and indirectly related to the course.
This is a work-in-progress.
100% Reliability In an perfect world everything is 100% reliable.
Too bad we don&amp;rsquo;t have one. Expecting perfect reliability is a mistake:</description></item><item><title>Ambiguity in spoken and programming languages</title><link>https://www.gmarik.info/blog/2019/ambiguity-spoken-programming-languages/</link><pubDate>Sun, 03 Nov 2019 01:59:10 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/ambiguity-spoken-programming-languages/</guid><description>Notes on ambiguity and its effects in spoken and programming languages.
This post touches on:
syntactic ambiguity (and disambiguation) in spoken language(SL) syntactic ambiguity (and disambiguation) in programming languages(PL) deliberate ambiguity and its effects PS: i&amp;rsquo;m not a linguist and all my findings are empirical so feel free to point out my mistakes…
Ambiguity Let&amp;rsquo;s define &amp;lsquo;ambiguity&amp;rsquo;:
the quality of being open to more than one interpretation.</description></item><item><title>Cdp-proxy: Chrome DevTools proxy and middleware for Go</title><link>https://www.gmarik.info/blog/2019/cdp-proxy-chrome-devtools-proxy-middleware-golang/</link><pubDate>Mon, 07 Oct 2019 19:10:04 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/cdp-proxy-chrome-devtools-proxy-middleware-golang/</guid><description>Leveraging Chrome DevTools for HTTP middleware observability and building a HTTP reverse|forward proxy with Go.
TLDR cdp-proxy project is 2 things:
a reverse|forward proxy with cdp-proxy executable an http.Handler middleware to plug your Go project to Chrome DevTools cdp-proxy is short for Chrome DevTools protocol.
cdp-proxy: a reverse|forward proxy cdp-proxy executable is just like any other mitm style proxy: configure it as your HTTP proxy and you&amp;rsquo;ll get the requests showing up in Chrome DevTools.</description></item><item><title>12 factor configuration with Go's `flag` package</title><link>https://www.gmarik.info/blog/2019/12-factor-golang-flag-package/</link><pubDate>Mon, 16 Sep 2019 10:10:10 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/12-factor-golang-flag-package/</guid><description>Cost-effective way to have your app conform with 12 factor methodology with Go&amp;rsquo;s stock flag package.
Summary Previously, before &amp;ldquo;cloud&amp;rdquo; was a thing, it was common to have configuration part of the source code, ie Rails&amp;rsquo; config/database.yaml.
These days, with immutable infrastucture, separation of configuration and code is preferred; quoting 12 factor:
III. Config Store config in the environment An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc).</description></item><item><title>Hosting static site with Hugo, Nginx, and Cloud Run</title><link>https://www.gmarik.info/blog/2019/hosting-static-site-with-hugo-cloud-build-nginx-cloud-run-for-free/</link><pubDate>Fri, 26 Jul 2019 10:38:01 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/hosting-static-site-with-hugo-cloud-build-nginx-cloud-run-for-free/</guid><description>TLDR Cloud Run is a great platform to host your static site. The article describes the process of setting up one with focus on best practices and simplicity.
Hosting gmarik.info My blogging setup had changed couple of times now:
Blogging with jekyll, rack and heroku for free! Hosting static site with App Engine, Cloud Build and Hugo The last platform was fast and worked well except few things:</description></item><item><title>Datadog APM: Traces + Metrics</title><link>https://www.gmarik.info/blog/2019/datadog-apm-traces-metrics/</link><pubDate>Mon, 22 Jul 2019 10:10:10 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/datadog-apm-traces-metrics/</guid><description>I&amp;rsquo;ve been working with Datadog&amp;rsquo;s Application Perfomance Monitoring recently and discovered that the APM agent produces both traces and metrics, which isn&amp;rsquo;t obvious from looking at the docs.
When the APM is configured, ie for ruby:
require &amp;#39;ddtrace&amp;#39; Datadog.configure do |c| # This will activate auto-instrumentation for Rails c.use :rails end Then the agent starts collecting various rails traces. Also, it collects related metrics (aka trace metrics).
The differenece is important since 1) traces are sampled and metrics aren&amp;rsquo;t 2) traces provide much more information than metrics</description></item><item><title>Javascript is my favorite language</title><link>https://www.gmarik.info/blog/2019/javascript-is-my-favorite-language/</link><pubDate>Thu, 04 Jul 2019 14:56:05 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/javascript-is-my-favorite-language/</guid><description>…well, one of!
Javascript has a bad wat reputation. Despite the difficult history and being an ugly-duck of programming languages there are some ideas that Javascript today does better than other languages in my opinion.
Brendan Eich wrote javascript in 10 days, in May 1995 https://en.wikipedia.org/wiki/JavaScript
Personal context In past I&amp;rsquo;ve never fully commited to writing Javascript. jQuery was my goto to enhance Rails apps for a long time but I never really invested into learning the language.</description></item><item><title>SwiftUI Hello World</title><link>https://www.gmarik.info/blog/2019/swiftui-hello-world/</link><pubDate>Wed, 05 Jun 2019 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/swiftui-hello-world/</guid><description>Minimal SwiftUI example If you&amp;rsquo;re eager to get your feet wet with SwiftUI the minimal sample may look like this:
import SwiftUI struct App: View { var body = Text(&amp;#34;Hello World&amp;#34;) } But hold your horses Unless you&amp;rsquo;re Swift developer you&amp;rsquo;re unlikely to have all the required software. So the challenge now is how to get minimal number of required components to be able to try SwiftUI.
For me, having:</description></item><item><title>Monotonic Time, or Perfect model vs Imperfect Reality</title><link>https://www.gmarik.info/blog/2019/monotonic-time-perfect-model-vs-imperfect-reality/</link><pubDate>Thu, 23 May 2019 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2019/monotonic-time-perfect-model-vs-imperfect-reality/</guid><description>A Day: Perfect model vs Imperfect Reality Expectation: 1 Day = 24 Hours = 86,400.000s Reality: 1 Day ~ 24 Hours ~ 86,400.002s (SI, mean) 1 Day is not exactly 24 hours Time And Date
1 Day (measured with Solar Time) is the time it takes the Earth to rotate around its own axis so the Sun appears in the &amp;ldquo;same position&amp;rdquo; in the sky.
It takes mean 1s/0.</description></item><item><title>Hosting static site with App Engine, Cloud Build and Hugo</title><link>https://www.gmarik.info/blog/2018/static-site-with-gcp-app-engine-cloud-build-hugo/</link><pubDate>Sun, 02 Dec 2018 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2018/static-site-with-gcp-app-engine-cloud-build-hugo/</guid><description>So once in a while I try new platform to host my blog. So far i&amp;rsquo;ve tried Heroku+Jekyll, VPS+Nginx, Netlify+Hugo.
Every option has its Cons and Pros but this post is about: App Engine + Cloud Build + Hugo.
Requirements https support git push style deploys support for various static site compilers cheap fast Note: if you&amp;rsquo;re looking for the simplest setup it&amp;rsquo;s the Netlify, IMO.
App Engine + Cloud Build satisfies the requirements above:</description></item><item><title>Testing MongoDB queries with Golang</title><link>https://www.gmarik.info/blog/2017/testing-mongodb-queries-golang/</link><pubDate>Sat, 19 Aug 2017 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2017/testing-mongodb-queries-golang/</guid><description>At Rover.io we&amp;rsquo;re migrating existing rails/node monoliths into microservice based architecture. Recently we launched another Go powered, mongodb backed service which tracks device events.
This post is documents steps taken while debugging performance issues and using tests to detect and prevent performance degradation.
Why Mongo Our service is backed by mongodb for few reasons:
enable customer to have flexible schema for their data previous service was using mongodb and we aimed to minimize downtime during data migration have an ability to quickly query DB to address support issues Performance issues We&amp;rsquo;re tracking quite a bit of events: New gRPC interfaced services are gradually introduced into the existing system and the image shows a nodejs server request latency talking to a Go backend.</description></item><item><title>Wordfight: a multi-player word game</title><link>https://www.gmarik.info/blog/2017/wordfight-multiplayer-word-game/</link><pubDate>Tue, 14 Mar 2017 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2017/wordfight-multiplayer-word-game/</guid><description>I&amp;rsquo;ve published my first word game wordfight inspired by venerable Letterpress. It&amp;rsquo;s a game where players make up words from the letters on the board. Whoever takes the most letters wins once all the letters are taken.
The idea has been in my &amp;ldquo;todo&amp;rdquo; for few reasons:
algorithmic problem at heart build a UI with reactjs build a bot opponent and AI real-time multi-player app with golang experimentation platform Algorithmic problem This is a typical CS problem where data structures and algorithms matter.</description></item><item><title>First Appengine experience</title><link>https://www.gmarik.info/blog/2017/appengine-experience/</link><pubDate>Sat, 11 Mar 2017 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2017/appengine-experience/</guid><description>or how I almost had to invert a binary tree to use it.
Good Google announced &amp;lsquo;Always Free&amp;rsquo; products during its Google Cloud Next‘17
Plus, we’re introduced new Always Free products &amp;ndash; non-expiring usage limits that you can use to test and develop applications at no cost. Visit the Google Cloud Platform Free Tier page for details.
(see FAQ for more)
It&amp;rsquo;s a great incentive to start tinkering with Google&amp;rsquo;s infrastructure I must say.</description></item><item><title>How to code review</title><link>https://www.gmarik.info/blog/2017/how-to-code-review/</link><pubDate>Mon, 23 Jan 2017 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2017/how-to-code-review/</guid><description>Code review is one of most important tools when it comes to social software development. But there&amp;rsquo;s an aspect that may ruin the whole experience as code-review becomes point of inter-personal tensions due to various reasons.
By carefully constructing the language you can make a difference for everyone involved.
Here are my notes from personal experience.
As a reviewer Address the code, not the author: why are you logging here?</description></item><item><title>Understanding Go's `for` loop with closures</title><link>https://www.gmarik.info/blog/2016/understanding-golang-for-loop-with-closures/</link><pubDate>Thu, 21 Jul 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/understanding-golang-for-loop-with-closures/</guid><description>In this post we&amp;rsquo;ll ponder the Go peculiarities when working with for range loops and closures.
Problem On of the Go gotchas when coming from other languages is how for range loop operates with closures.
Here&amp;rsquo;s a simple example:
package main import &amp;#34;os&amp;#34; func main() { for _, arg := range os.Args { defer func() { println(arg) }() } } Running the example:
$ go run for.go hello world one would expect the command line arguments printed in some order.</description></item><item><title>Simple execution pipelines with Ruby</title><link>https://www.gmarik.info/blog/2016/simple-execution-pipelines-with-ruby/</link><pubDate>Mon, 11 Jul 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/simple-execution-pipelines-with-ruby/</guid><description>This post describes building simple composable execution pipelines with Ruby, it&amp;rsquo;s a useful technique that enables writing reusable, chainable and testable components.
Execution pipeline Execution pipeline (also known as Chain of responsibility pattern) focuses on performing set of actions; IE an &amp;ldquo;order creation pipeline&amp;rdquo;:
creates an order creates order details decreases inventory sends out notifications etc. I&amp;rsquo;d like to note that execution pipeline is a bit different from a data pipeline in a way that it focuses on performing often unrelated actions rather than transforming data(stream).</description></item><item><title>Using vim to stream-process text</title><link>https://www.gmarik.info/blog/2016/using-vim-to-stream-process-text/</link><pubDate>Thu, 09 Jun 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/using-vim-to-stream-process-text/</guid><description>Problem Imagine we have a one-off task of copying subset of files residing in an s3 bucket to another bucket.
We&amp;rsquo;re going to use aws s3 ls s3://a_bucket/path/ command to get the list of files and then only copy the ones that match a pattern.
Let&amp;rsquo;s assume the resulting file-list looks something like this:
$ cat in.txt 2013-03-29 14:35:03 10314739 20130314T011325_WCBK_SCHEDULE.XML 2013-03-29 14:35:07 81378 20130314T012706_CBK_TOURNAMENT.XML 2013-03-29 14:35:07 11659596 20130314T012735_CBK_SCHEDULE.XML 2013-03-29 14:35:18 421 20130314T100002_CBK_LIVE.</description></item><item><title>Experimenting with Go pipelines</title><link>https://www.gmarik.info/blog/2016/experimenting-with-golang-pipelines/</link><pubDate>Fri, 27 May 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/experimenting-with-golang-pipelines/</guid><description>Pipelines is a powerful concept that is language independent and is &amp;ldquo;a must&amp;rdquo; for any developer to master.
This post discusses concept of pipelines and how it can affect application speed; it also assumes some Go and basics of concurrency knowledge.
A naive prime calculation algorithm is chosen deliberately for the sake of demonstration in this post and, instead of improving the algorithm, speed-up is achieved by utilizing process composition (using concurrency and parallelism).</description></item><item><title>Understanding Go's `nil` value</title><link>https://www.gmarik.info/blog/2016/understanding-golang-nil-value/</link><pubDate>Mon, 09 May 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/understanding-golang-nil-value/</guid><description>This post raises more questions than answers (for me). While I&amp;rsquo;m learning more about what Go&amp;rsquo;s nil is I&amp;rsquo;ll be making assumptions based on how the languages behaves. I&amp;rsquo;ll try to collect the answers from the Go&amp;rsquo;s source code, but in the mean time: just plain assumptions, feel free correct.
Nil is a typed value Type information is inherent part of a nil value in Go. Lack of type information is a compilation error:</description></item><item><title>Outsourcing voicemail to Twilio</title><link>https://www.gmarik.info/blog/2016/outsourcing-vociemail-to-twilio/</link><pubDate>Sun, 24 Apr 2016 16:09:04 -0400</pubDate><guid>https://www.gmarik.info/blog/2016/outsourcing-vociemail-to-twilio/</guid><description>After moving to Canada, part of initial culture shock was the fact how expensive cell phone services are. That motivated me to started thinking how to migrate off cell-provided services.
Another reason for migration was the fact that service providers have surprisingly poor service quality:
@Fidomobile been trying to give you my money but you&amp;#39;re resisting too hard. Yet my number stopped working. “Thanks&amp;quot;! pic.twitter.com/BLQXQGs972
&amp;mdash; gmarik (@gmarik) April 16, 2016 Voicemail was the perfect candidate to migrate and this post covers how to do it with Twilio.</description></item><item><title>IoT sensor metrics with Go - Part 2</title><link>https://www.gmarik.info/blog/2016/iot-sensor-metrics-with-go-part2/</link><pubDate>Sat, 09 Apr 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/iot-sensor-metrics-with-go-part2/</guid><description>This is Part 2 of the 2-post series. See Part 1 if you haven&amp;rsquo;t yet.
Hacked together sensor reporting since #Intel provides free analytics platform. Blog post soon. #Golang #IoT pic.twitter.com/WllvBPLr8j
&amp;mdash; gmarik (@gmarik) February 19, 2016 In this post we&amp;rsquo;ll go through the process of configuring and running sensor-reporter and submitting the sensor metrics to the EnableIoT platform
Plan Assuming you&amp;rsquo;re already registered with the EnableIoT platform, here&amp;rsquo;s the action plan of this post:</description></item><item><title>IoT sensor metrics with Go - Part 1</title><link>https://www.gmarik.info/blog/2016/iot-sensor-metrics-with-go-part1/</link><pubDate>Thu, 07 Apr 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/iot-sensor-metrics-with-go-part1/</guid><description>In Nov 2015 I participated in Intel Roadshow where people hacked on Intel Edison powered projects.
Got a temperature sensor running hooked to http server and LCD #edison #IntelMakerON #fun pic.twitter.com/IJCC0olW8c
&amp;mdash; gmarik (@gmarik) November 21, 2015 After the hackathon, I couldn&amp;rsquo;t come up with a good idea what to do with the device, so I decided to go with the obvious one: reporting sensor readings.
Luckily the event also advertised EnableIoT platform which was exactly what I needed for my project.</description></item><item><title>SIGTERM-ing SIGSTOP-ed process</title><link>https://www.gmarik.info/blog/2016/sigterm-sigstop-process/</link><pubDate>Tue, 08 Mar 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/sigterm-sigstop-process/</guid><description>Problem One of projects I&amp;rsquo;m working on is responsible for coordinating/running multiple processes. It&amp;rsquo;s a simple real-time web app that allows starting, stopping, pausing and terminating processes.
Since I&amp;rsquo;m developing and testing on OSX and the service is running on Linux I came across a surprising behaviour how those platforms handle particular signals.
Description Common scenario running a process looks like this:
Run a process to do some work Pause it (with SIGSTOP) Terminate paused process (with SIGTERM) I&amp;rsquo;ve observed 2 different behaviours:</description></item><item><title>Go's testing package side-effects</title><link>https://www.gmarik.info/blog/2016/go-testing-package-side-effects/</link><pubDate>Tue, 23 Feb 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/go-testing-package-side-effects/</guid><description>Problem I&amp;rsquo;ve been working on a Go CLI app to push sensor data to Cloud™ and hit the problem.
In order to read the sensor data I had a very simple piece of code:
package main //analog_read.go import ( &amp;#34;flag&amp;#34; &amp;#34;fmt&amp;#34; &amp;#34;os&amp;#34; &amp;#34;github.com/hybridgroup/gobot/platforms/intel-iot/edison&amp;#34; ) var ( pin = flag.String(&amp;#34;pin&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;Sensor&amp;#39;s pin-ID to read analog value from. Required.&amp;#34;) ) func main() { flag.Parse() if *pin == &amp;#34;&amp;#34; { flag.PrintDefaults() os.</description></item><item><title>Autocompletion and request cancellation</title><link>https://www.gmarik.info/blog/2016/autocompletion-request-cancellation-jquery-and-go/</link><pubDate>Thu, 18 Feb 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/autocompletion-request-cancellation-jquery-and-go/</guid><description>Problem Imagine we&amp;rsquo;re tasked to implement a search with auto-completion support.
Because it&amp;rsquo;s an auto-completion, every time the search phrase is changed, there&amp;rsquo;s a chance to have more than one outstanding request going at a time.
How do we keep resource usage to a minimum and avoid unnecessary requests?
Possible Solutions keep at most one(the latest) request going at a time cancel any other(previous) requests do not submit request unless user finished entering search phrase Note: Having fast search backend is actually a must-have requirement and whole point of auto-completion, but for the sake of demonstration, a slow one is used instead.</description></item><item><title>Immutable by default?!</title><link>https://www.gmarik.info/blog/2016/immutable-by-default/</link><pubDate>Mon, 08 Feb 2016 23:55:55 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/immutable-by-default/</guid><description>Problem After I started learning about [FP] couple years ago my code started resemble pseudo-purely-functional one:
# Version A # builds a reverse item-to-category map def items_to_categories_map reducer = -&amp;gt; (acc, (cat, items)) do items.reduce(acc) { |acc, item| acc.merge(item =&amp;gt; cat) } end CAT_TO_ITEM_MAP.reduce({}, &amp;amp;reducer) end CAT_TO_ITEM_MAP = { &amp;#39;numbers&amp;#39; =&amp;gt; %w[0 1 2 3], &amp;#39;letters&amp;#39; =&amp;gt; %w[a b c d], } today I&amp;rsquo;d have written the same code this way:</description></item><item><title>5 tips for solid Bash code</title><link>https://www.gmarik.info/blog/2016/5-tips-for-solid-bash-code/</link><pubDate>Wed, 27 Jan 2016 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2016/5-tips-for-solid-bash-code/</guid><description>Here are few things that help improve my Bash code when a script grows more than just couple lines but not enough to be rewritten with Go.
Tip 1: fail early Probably is well known but still worth mentioning:
-e Exit immediately if a pipeline (which may consist of a single simple command), a list, or a compound command, exits with a non-zero status. See man bash's &amp;ldquo;SHELL BUILTIN COMMANDS&amp;rdquo; chapter.</description></item><item><title>Test Driven Devops with Ansible</title><link>https://www.gmarik.info/blog/2015/test-driven-devops-with-ansible/</link><pubDate>Thu, 03 Dec 2015 19:25:59 -0500</pubDate><guid>https://www.gmarik.info/blog/2015/test-driven-devops-with-ansible/</guid><description>Or using Ansible as an acceptance test tool.
Problem My blog has received major overhaul couple days ago:
migrated to Hugo from Jekyll migrated to DigitalOcean from Heroku adopted Ansible for provisioning and setup migrated to www.gmarik.info from gmarik.info new blog permalink format /blog/:year/:slug(as month/day do not matter much in url) Preserving site permalinks was my major migration concern and it&amp;rsquo;s easy to break them since there are many changes involved.</description></item><item><title>Gorack a Go webserver for Rack apps</title><link>https://www.gmarik.info/blog/2015/gorack-go-webserver-rack/</link><pubDate>Wed, 25 Feb 2015 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2015/gorack-go-webserver-rack/</guid><description>In my spare time i&amp;rsquo;ve been working on a project that involves IPC with Rack applications from a Go app. It was quite easy to extract IPC code into a standalone module and it&amp;rsquo;s going opensource today.
The project is called Gorack and it&amp;rsquo;s a:
Go frontend webserver for Ruby&amp;rsquo;s Rack applications
Feel free to checkout Gorack readme and try it out.
Let me know what you think.</description></item><item><title>Share by communicating</title><link>https://www.gmarik.info/blog/2014/share-by-communicating/</link><pubDate>Fri, 04 Apr 2014 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2014/share-by-communicating/</guid><description>I&amp;rsquo;ve been looking for a good explanation to the concurrency slogan:
Do not communicate by sharing memory; instead, share memory by communicating
Having found none that satisfy my requirements:
initial problem with an example provide Shared Memory solution provide Share by Communicating solution this post is my take on explaining the subject.
After reading it one should be able to get an idea of &amp;lsquo;Share by Communicating&amp;rsquo; model, how it&amp;rsquo;s different from &amp;lsquo;Communicate by Sharing&amp;rsquo; model and how they both solve problem of access and modification a shared resource.</description></item><item><title>Why I stopped contributing to vundle</title><link>https://www.gmarik.info/blog/2014/why-i-stopped-contributing-to-vundle/</link><pubDate>Tue, 04 Feb 2014 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2014/why-i-stopped-contributing-to-vundle/</guid><description>Vundle is my most popular OSS project. Yet I stopped contributing to it a while ago.
Here I&amp;rsquo;ll try cover my reasons and also to initiate discussion about Vundle&amp;rsquo;s future.
History Vundle was written to serve my personal needs as an experiment. It took me a day(while I was sick) to get initial version out and I spent significant time after polishing it towards v1.0 which hasn&amp;rsquo;t seen the light yet.</description></item><item><title>TLS auth in SOA</title><link>https://www.gmarik.info/blog/2014/tls-auth-in-soa/</link><pubDate>Tue, 14 Jan 2014 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2014/tls-auth-in-soa/</guid><description>Problem client authentication in Service Oriented Architecture (SOA) Solution Encrypted communication is a must these days, it(TLS) also could be used for client auth.
TLS Transport Layer Security and its predecessor, Secure Sockets Layer (SSL), are cryptographic protocols which are designed to provide communication security over the Internet.
Authentication Authentication (from Greek: αὐθεντικός; real or genuine, from αὐθέντης authentes; author) is the act of confirming the truth of an attribute of a datum or entity</description></item><item><title>3 Ways to get your iOS app data out</title><link>https://www.gmarik.info/blog/2013/three-ways-to-get-your-ios-app-data/</link><pubDate>Mon, 19 Aug 2013 00:00:02 +0000</pubDate><guid>https://www.gmarik.info/blog/2013/three-ways-to-get-your-ios-app-data/</guid><description>As far as I know there are 3 ways:
Organizer iTunes iTunes Backup Assuming that you can deploy the app to the device.
Organizer Organizer lets you quickly download app data from a device.
Press download to get data saved.
This approach doesn&amp;rsquo;t work if an app is installed from AppStore even if you&amp;rsquo;re the developer.
iTunes iTunes mediates access to the Documents/ folder in App Sandbox. It&amp;rsquo;s disabled by default and could be enabled with the snippet:</description></item><item><title>MHAboutView for iOS</title><link>https://www.gmarik.info/blog/2013/mhaboutview-ios/</link><pubDate>Mon, 19 Aug 2013 00:00:01 +0000</pubDate><guid>https://www.gmarik.info/blog/2013/mhaboutview-ios/</guid><description>Just pushed first useful(in my opinion) Objective-C component. It&amp;rsquo;s called MHAboutView and is a generic &amp;lsquo;about view&amp;rsquo; for iOS apps.
Problem Enable users to give feedback to app publisher.
It&amp;rsquo;s very important for a developer to stay in touch with customers:
bug reports answering questions feature requests are beneficial for both parties.
MHAboutView Most iOS apps provide no means for a customer to communicate back to developer.</description></item><item><title>Regularly.me or how to GTD</title><link>https://www.gmarik.info/blog/2013/regularly.me-or-how-to-get-things-done/</link><pubDate>Sun, 26 May 2013 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2013/regularly.me-or-how-to-get-things-done/</guid><description>It&amp;rsquo;s hard to work on a side project and get it done. Esp when it&amp;rsquo;s something new, complicated, takes a lot of time, and you don&amp;rsquo;t get paid for it.
But it&amp;rsquo;s achievable!
&amp;ldquo;So, why do it when you don&amp;rsquo;t get paid?&amp;rdquo; – one may ask. just for fun. Well, it&amp;rsquo;s not always about fun though, it&amp;rsquo;s about learning too. And learning is never easy, esp. learnin-by-doing.
Regularly.me Regularly.</description></item><item><title>Recursive data structures with Rails</title><link>https://www.gmarik.info/blog/2012/recursive-data-structures-with-rails/</link><pubDate>Sun, 14 Oct 2012 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/recursive-data-structures-with-rails/</guid><description>Or adding a &amp;ldquo;tree&amp;rdquo; to your app.
Problem It&amp;rsquo;s often necessary to store hierarchical data in DB. We&amp;rsquo;ll review available models and their strengths and weaknesses. Since knowing theory is good but not enough, pluggable solutions are considered for Ruby On Rails framework.
Theory There are several ways to model recursive/hierarchical data with relational DB:
Adjacency List Nested Sets Path Enumeration (aka Materialized Path) Closure Table Adjacency List with recursive query Note: following examples are missing foreign keys and indexes just for sake of simplicity</description></item><item><title>Orphan vs Zombie vs Daemon processes</title><link>https://www.gmarik.info/blog/2012/orphan-vs-zombie-vs-daemon-processes/</link><pubDate>Wed, 15 Aug 2012 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/orphan-vs-zombie-vs-daemon-processes/</guid><description>Process In computing, a process is an instance of a computer program that is being executed.
Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.
Parent Process In the operating system Unix, every process(except the very first one) is created when a process creates a new process.
Those 2 processes establish a relationship where:
parent process is the process that created the new process child process is the newly-created process.</description></item><item><title>Large MySQL migrations with pt-online-schema-change</title><link>https://www.gmarik.info/blog/2012/large-mysql-migrations/</link><pubDate>Tue, 14 Aug 2012 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/large-mysql-migrations/</guid><description>pt-online-schema-change is a CLI script and part of Percona-toolkit by Percona.
It&amp;rsquo;s one of the most efficient tools for performing large MySQL table migrations, minimizing DB downtime.
Here&amp;rsquo;s a rough outline of the performed operations:
create empty a_table_new duplicating a_table's stucture alter empty a_table_new as specified(performs structure migration) add data-copy-trigger to a_table so any new data gets copied to a_table_new copy actual records from a_table to a_table_new swap a_table with a_table_new by performing an atomic rename So a_table_new becomes a_table with altered structure and all the data.</description></item><item><title>Xtrabackup to backup/restore MySql</title><link>https://www.gmarik.info/blog/2012/xtrabackup-to-backup-restore-mysql/</link><pubDate>Fri, 27 Jul 2012 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/xtrabackup-to-backup-restore-mysql/</guid><description>Along with widely used mysqldump there are often times when Raw backups need to be performed.
These are my notes on this subject.
Raw Backup vs Logical Backup Below backup comparison is an excerpt from High Performance Mysql 2nd ed
BTW they released 3rd edition of High Performance Mysql in March 2012.
Logical Backup Pros:
Consists of normal text files; which means they&amp;rsquo;re editable/inspectable with regular tools like sed/awk/vim Easy to restore using mysql or mysqlimport Easy to backup/restore across the network Flexible as mysqldump has many options and WHERE sql clause to filter records Storage engine independant With right options backup is DB neutral Cons:</description></item><item><title>Gem Rails Like Sinatra Talk</title><link>https://www.gmarik.info/blog/2012/gem-rails-like-sinatra-talk/</link><pubDate>Thu, 26 Jan 2012 21:01:01 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/gem-rails-like-sinatra-talk/</guid><description>Today I gave a Gem Rails Like Sinatra talk at winnipeg.rb meet-up, about rails-mini gem.
Theck them both out and let me know what you think.</description></item><item><title>Map as a Presenter pattern and more</title><link>https://www.gmarik.info/blog/2012/map-as-presenter-and-more/</link><pubDate>Mon, 16 Jan 2012 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2012/map-as-presenter-and-more/</guid><description>What are the responsibilities of a Presenter?
The presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view
or briefly
transform data from one to another form(representation)
I like to think of Presenter as just a transformation function withing a context(an MVC).
Thinking with mapping Map is a very simple but powerful concept. Rubyists (and other functional style ppl) use it often to transform data:</description></item><item><title>Vim Script Best Practices</title><link>https://www.gmarik.info/blog/2011/vim-script-best-practices-rant/</link><pubDate>Mon, 26 Dec 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/vim-script-best-practices-rant/</guid><description>Happy Holidays everyone!
This post has been sitting in my drafts for a while now, so today I finally managed to complete it.
Antipatterns There are best-practices for all kinds of programming languages but I haven&amp;rsquo;t seen vim-script&amp;rsquo;s one.
This post doern&amp;rsquo;t try to cover actual best practices but rather just &amp;ldquo;issues&amp;rdquo; often found when scripting Vim.
1. Copy-pasting There are number of WIKIs, blog posts, super-duper-vim-configs unintentionally propagating copy-pasting anti-pattern.</description></item><item><title>Ruby and Mysql on OSX Snow Leopard</title><link>https://www.gmarik.info/blog/2011/ruby-and-mysql-on-osx/</link><pubDate>Fri, 11 Nov 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/ruby-and-mysql-on-osx/</guid><description>Gotta stop googling everytime this happens.
Mysql Load mysql dump $ mysqld_safe &amp;amp; # start mysql server $ mysql -u root app_development &amp;lt; dump.sql # load dump ERROR 2006 (HY000) at line 151988: MySQL server has gone away oops looks like we got an error
Customize Mysql configuration $ mysqladmin -u root shutdown # shutdown server for configuration change $ mkdir -p /usr/local/mysql/etc # create configuration dir if doesn't exist $ cp /usr/local/mysql/{support-files/my-large.</description></item><item><title>How to make Xcode 4 default</title><link>https://www.gmarik.info/blog/2011/how-to-make-xcode-4-default/</link><pubDate>Fri, 14 Oct 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/how-to-make-xcode-4-default/</guid><description>I have two Xcodes versions installed 3.2.4 and 4.2. And the former one was the default one. This wasn&amp;rsquo;t a big deal unless I tried to open a project in Finder which caused Xcode 3.2.4 to pop up.
Defaultig to Xcode 4 is a bit tricky:
CTRL-click on a project so context menu pops up, select Open with File selection dialog pops up. Press Shift-CMD-G - Goto Filder dialog pops up.</description></item><item><title>Design for developers</title><link>https://www.gmarik.info/blog/2011/design-for-developers/</link><pubDate>Tue, 27 Sep 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/design-for-developers/</guid><description>Designing good UX is hard.
Especially for developers without design background. Messing with UI was one of my most time consuming activities with little outcome.
Ready-to-use-templates were probably the only solution which didn&amp;rsquo;t make developer stuck with UI. And there are lots of sites you can get one from.
Those templates aren&amp;rsquo;t very reusable though(unless all of your project look the same)
I always wanted something more generic and easy to modify.</description></item><item><title>Beginning iOS</title><link>https://www.gmarik.info/blog/2011/beginning-ios/</link><pubDate>Fri, 16 Sep 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/beginning-ios/</guid><description>I&amp;rsquo;m learning (new to me) platform from Apple. Here are my impressions so far.
Objective-C (the ugly) After programming Ruby for a while, Objective-C looks kinda ugly, ie:
+ (MyGizmoClass*)sharedManager { if (sharedGizmoManager == nil) { sharedGizmoManager = [[super allocWithZone:NULL] init]; } return sharedGizmoManager; } When you look at this code the very first time you&amp;rsquo;ll probably spend some time parsing syntax:
+ very little chance guesing its meaning (MyGizmoClass *) is probably a return type nil is an equivalent to NULL or null pointer [[super allocWithZone:NULL] init]; looks like a method call, but very confusing, esp :NULL part I&amp;rsquo;m not going to explain meaning here instead I&amp;rsquo;m just pointing out things that(to my taste) are ugly and too verbose.</description></item><item><title>Vundle 0.9 got awesome installer</title><link>https://www.gmarik.info/blog/2011/vundle-0.9-got-awesome-installer/</link><pubDate>Thu, 25 Aug 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/vundle-0.9-got-awesome-installer/</guid><description>Vundle, the plugin manager for Vim, just got major usability improvements.
Prior to 0.9 Before 0.9, Vundle used echoing to display progress. Echoing is poorly usable:
no way to see updates clearly hard to track errors too verbose differs for GUI/CLI versions New UI Vundle 0.9 uses Vim&amp;rsquo;s buffer to display data. For example installation progress (of :BundleInstall command) looks: New version uses Vim&amp;rsquo;s signs(:h signs) to mark results:</description></item><item><title>Game of life in vim</title><link>https://www.gmarik.info/blog/2011/game-of-life-in-vim/</link><pubDate>Sun, 22 May 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/game-of-life-in-vim/</guid><description>Video of Conway&amp;rsquo;s Game of Life running in Vim using golife.vim</description></item><item><title>Chicken or Egg dilemma</title><link>https://www.gmarik.info/blog/2011/chicken-or-egg-dilemma/</link><pubDate>Tue, 17 May 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/chicken-or-egg-dilemma/</guid><description>Chicken or Egg dilemma is known from the ancient days.
In case of Vundle the dilemma manifests itself as a bunch of errors during bundles installation in certain conditions.
Problem It&amp;rsquo;s pretty common to have settings that are plugin dependant. For instance, lets have statusline to display current git branch, ie:
set statusline=+&amp;#39;%&amp;lt;\ %f\ %{fugitive#statusline()}&amp;#39;which requires fugitive bundle auto-loadable when status line is displayed.
Having such dependency means that each time Vim runs without fugitive - causes errors!</description></item><item><title>Vundle is a bundle too</title><link>https://www.gmarik.info/blog/2011/vundle-is-bundle/</link><pubDate>Mon, 16 May 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/vundle-is-bundle/</guid><description>Today Vundle got better!
Couple folks had mentioned that i&amp;rsquo;d be nice to have Vundle inside bundle/ dir. In that case Vundle gets same treatment as other bundles, and help issue gets fixed automatically.
How to bundle vundle For those who haven&amp;rsquo;t yet moved Vundle to bundle/ dir here are migration steps:
Change vundle&amp;rsquo;s runtime path:
from
set rtp+=~/.vim/vundle.gitto
set rtp+=~/.vim/bundle/vundle &amp;#34; without .gitin your .vimrc
Configure Vundle as a bundle in .</description></item><item><title>Installing Vim plugins with Vundle on Windows</title><link>https://www.gmarik.info/blog/2011/windows-vim-plugins-vundle/</link><pubDate>Sun, 10 Apr 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/windows-vim-plugins-vundle/</guid><description>Vundle v0.8 adds Windows suport! If you&amp;rsquo;re not Windows user it still worth updating Vundle, otherwise read on&amp;hellip;
Before you can jump into installing plugins with Vundle, you need to have 2 dependencies configured:
Git Curl Git on Windows Thanks to msysgit installation is trivial:
Download msysgit installer run downloaded installer and follow instructions It&amp;rsquo;s important to configure PATH environment variable properly. That&amp;rsquo;s why it&amp;rsquo;s recommended to select Run git from Windows command prompt option, as shown: After installation try running git --version within command prompt (press Win-R, type cmd, press Enter) to make sure all good:</description></item><item><title>Vundle 0.7 is out</title><link>https://www.gmarik.info/blog/2011/vundle-0.7-out/</link><pubDate>Sat, 19 Mar 2011 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2011/vundle-0.7-out/</guid><description>As you may know Vundle is a plugin manager for Vim. Before Vundle I was a pathogen user
Vundle-0.7 was out today and adds some nice features!
Github short URIs Vundle loves GitHub that&amp;rsquo;s why Vundle commands recognize short github URIs:
so instead of:
&amp;#34; .vimrc...Bundle &amp;#39;http://github.com/tpope/vim-fugitive&amp;#39;Bundle &amp;#39;http://github.com/nelstrom/vim-mac-classic-theme.git&amp;#39;short versions are available
&amp;#34; .vimrc...Bundle &amp;#39;tpope/vim-fugitive&amp;#39;Bundle &amp;#39;nelstrom/vim-mac-classic-theme.git&amp;#39;Note: Vundle defaults to http:// protocol for short URIs
Short URIs are especially handy when you need quickly install a script:</description></item><item><title>Grep vs Ack and weird Homebrew policy</title><link>https://www.gmarik.info/blog/2010/grep-vs-ack-and-weird-homebrew-policy/</link><pubDate>Sat, 18 Dec 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/grep-vs-ack-and-weird-homebrew-policy/</guid><description>Using Ack was frustrating experience recently. Ack had troubles finding things.
$ time ack -Ri 'cancel the remaining quantity of this line item' ./app real 0m0.730s user 0m0.220s sys 0m0.137s $ time grep -Ri 'cancel the remaining quantity of this line item' ./app ./app/views/order_line_items/_cancel_form.html.haml: Cancel the remaining quantity of this line item: real 0m13.791s user 0m0.282s sys 0m0.321s $ time git grep -i 'cancel the remaining quantity of this line item' .</description></item><item><title>Scraping ASP.Net site with Mechanize</title><link>https://www.gmarik.info/blog/2010/scraping-asp-net-site-with-mechanize/</link><pubDate>Sat, 16 Oct 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/scraping-asp-net-site-with-mechanize/</guid><description>One day I needed to automate downloads from ASP.Net powered site.
I&amp;rsquo;ve never done any ASP befor so I don&amp;rsquo;t realy know how that works. While digging my site I&amp;rsquo;ve found that it&amp;rsquo;s just a pile of crap (BTW if you need scraping protection - use ASP.net :) Also it seems like ASP technology tries to make simple things complex. Ie even a basic link is actually a form submission. also ASP abuses javascript by making it required even for simple pages.</description></item><item><title>Migration to rspec2</title><link>https://www.gmarik.info/blog/2010/migration-to-rspec2/</link><pubDate>Sun, 10 Oct 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/migration-to-rspec2/</guid><description>RSpec 2 just came out (as a bonus for 10/10/10 date?).
So before going to bed I decided to switch my small non rails project to new RSpec 2 mostly for the new [:focused] feature borrowed from Micronaut.
After bumping gem version in Gemfile
gem 'rspec', '~&amp;gt; 2.0.0' and running bundle install
... Installing rspec-core (2.0.0) Installing rspec-expectations (2.0.0) Installing rspec-mocks (2.0.0) Installing rspec (2.0.0) got it installed (wow, it&amp;rsquo;s modular now!</description></item><item><title>Ctags on OSX</title><link>https://www.gmarik.info/blog/2010/ctags-on-osx/</link><pubDate>Fri, 08 Oct 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/ctags-on-osx/</guid><description>Snow Leo ships with ctags not suitable for Ruby development. Ie if you try to generate tags recursively, it will error out:
$ ctags -R ctags: illegal option -- R usage: ctags [-BFadtuwvx] [-f tagsfile] file ... $ which ctags /usr/bin/ctags homebrew to the rescue:
$ brew install ctags ==&amp;gt; Downloading http://downloads.sourceforge.net/ctags/ctags-5.8.tar.gz ######################################################################## 100.0% ==&amp;gt; ./configure --prefix=/usr/local/Cellar/ctags/5.8 --enable-macro-patterns --mandir=/usr/local/Cellar/ctags/5.8/share/man --with-readlib ==&amp;gt; make install /usr/local/Cellar/ctags/5.8: 6 files, 392K, built in 12 seconds Now we need to alias ctags to use new version:</description></item><item><title>Vim scripts github mirror</title><link>https://www.gmarik.info/blog/2010/vim-scripts-github-mirror/</link><pubDate>Fri, 24 Sep 2010 00:00:03 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/vim-scripts-github-mirror/</guid><description>After Tim Pope invented pathogen it&amp;rsquo;s so much easier to manager vim plugins with git. Just run the update_bundle and boom - updated!
The only thing I missed was a git mirror of all vim scripts. Miss no more! Githubber Bronson aleady did that recently! And it&amp;rsquo;s called(surprise-surprise) vim-scripts and is hosted on hithub.
Now I can switch my update_bundle to those git repos!
Perfect! Thanks!
Why it&amp;rsquo;s important? Think of github and why you like it.</description></item><item><title>Ruby magic</title><link>https://www.gmarik.info/blog/2010/ruby-magic/</link><pubDate>Fri, 24 Sep 2010 00:00:02 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/ruby-magic/</guid><description>Ruby magic:
ruby &amp;lt;&amp;lt;-EOR puts (not(false 1)) EOR what would above yield?
I&amp;rsquo;m not sure but i think that newline here acts as statement separator, so last statement&amp;rsquo;s value gets negated and false yielded. Tricky</description></item><item><title>Native Irb experience on OSX</title><link>https://www.gmarik.info/blog/2010/install-readline-with-ruby-on-osx/</link><pubDate>Fri, 24 Sep 2010 00:00:01 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/install-readline-with-ruby-on-osx/</guid><description>By default ruby is installed with libedit library on OSX. This is really annoying especially with IRB, as default bash bindings (ie ^R for reverse history search) do not work. There&amp;rsquo;s workaround to enable history search, but now it&amp;rsquo;s event easier just to install ruby with readline enabled (RVM installation assumed), just run:
bash &amp;lt; &amp;lt;(curl http://github.com/gmarik/dotfiles/raw/master/bin/osx/rvm-install-ruby-readline) see source for more details.</description></item><item><title>rack-mail-exceptions-notification-middleware</title><link>https://www.gmarik.info/blog/2010/rack-mail-exceptions-notification-middleware/</link><pubDate>Sat, 18 Sep 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/rack-mail-exceptions-notification-middleware/</guid><description>I&amp;rsquo;m working on my small project devz.info - a sinatra powered app. And by nature I wanted to have exceptions delivered to my mailbox same way as exception_notification rails plugin does.
But mailexceptions middleware for rack didn&amp;rsquo;t really work for TLS enabled smtp, so I contributed patch and it has been applied!
Here&amp;rsquo;s sample config.ru
require &amp;#39;rack&amp;#39; require &amp;#39;rack/contrib&amp;#39; use Rack::MailExceptions.new do |mail| mail.to &amp;#39;foo@example.org&amp;#39; mail.from &amp;#39;bar@example.org&amp;#39; mail.subject &amp;#39;[ERROR] %s&amp;#39; mail.</description></item><item><title>Blogging with Jekyll, Rack and Heroku for free!</title><link>https://www.gmarik.info/blog/2010/blogging-with-jekyll-and-heroku-for-free/</link><pubDate>Mon, 10 May 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/blogging-with-jekyll-and-heroku-for-free/</guid><description>I&amp;rsquo;m not going to talk about setup and configuration cuz it&amp;rsquo;s trivial! Instead lets see how jekyll is served from heroku.
Jekyll generated site is a static site, so having something serving static files is just fine. There&amp;rsquo;s Rack::Static middleware shipped with Rack and you can use it for this purpose, ie with sample config.ru:
use ::Rack::Static, :root =&amp;gt; &amp;quot;public&amp;quot;, # or _site/ where *.html are generated :urls =&amp;gt; %w[/] # match all requests # otherwise 404 NotFound run lambda { [404, {'Content-Type' =&amp;gt; 'text/plain'}, ['whoops!</description></item><item><title>Tracking Dotfiles with Git</title><link>https://www.gmarik.info/blog/2010/tracking-dotfiles-with-git/</link><pubDate>Sun, 02 May 2010 00:00:02 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/tracking-dotfiles-with-git/</guid><description>Why? track changes simplify setup and maintenance simplify distribution ease of use: Git (or u don&amp;rsquo;t need another tool) How to track dotfiles git init --bare ~/dotfiles.git alias .G=&amp;quot;git --work-tree=$HOME/ --git-dir=$HOME/dotfiles.git&amp;quot; .G add ~/.gitcofig .G status -s -uno # review chagelist .G commit -a -m 'Git: adding user config' You may want to keep .G alias
alias .G &amp;gt;&amp;gt; ~/.bashrc Now we need to specify ignores and track .</description></item><item><title>Installing ruby 1.8.6 on OSX</title><link>https://www.gmarik.info/blog/2010/installing-ruby-1.8.6-on-osx/</link><pubDate>Sun, 02 May 2010 00:00:01 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/installing-ruby-1.8.6-on-osx/</guid><description>UPDATED Removing native OSX&amp;rsquo; ruby is a bad idea. Just use rvm or similar tool instead.
Restoring OSX ruby is pretty easy though: just copy your /System/Library/Ruby and /System/Library/Frameworks/Ruby.framework dirs from another OSX installation.
Setup Script setup-osx-ruby-1.8.6.sh (download)
Notes Ruby on Osx Ruby 1.8.7 is a default version(at the moment) OS X ships with.
root# ls -l /usr/bin/|grep 'Frameworks\/Ruby' erb -&amp;gt; ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/erb gem -&amp;gt; ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem irb -&amp;gt; ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/irb rdoc -&amp;gt; .</description></item><item><title>Building Rmagick gem and how to avoid memory leak</title><link>https://www.gmarik.info/blog/2010/building-rmagick-gem-and-memory-leak/</link><pubDate>Thu, 22 Apr 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/building-rmagick-gem-and-memory-leak/</guid><description>If you running Arch Linux you stay up to date all the time! As a down side - frequently broken dependencies once a system lib gets updated. Rmagick gem is a good example!
Once you get an error:
RuntimeError (This version of RMagick was created to run with ImageMagick 6.6.0 but ImageMagick 6.6.1-4 is installed on this system. You should either 1) Configure and build RMagick for ImageMagick 6.6.1-4, or 2) download ImageMagick 6.</description></item><item><title>Irb history with Ruby 1.8.6</title><link>https://www.gmarik.info/blog/2010/irb-history-on-ruby-1.8.6/</link><pubDate>Sat, 17 Apr 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/irb-history-on-ruby-1.8.6/</guid><description>Somehow got irb history broken.
Googling brought a solution
Here&amp;rsquo;s the simplified version of the fix I&amp;rsquo;ve came with:
module IRB def HistorySavingAbility.extended(obj); Kernel.at_exit{ HistorySavingAbility.create_finalizer.call } obj.load_history obj end end Put it into .irbrc
Turns out that finalizer is not guaranteed to run, so Kernetl.at_exit hook should be used instead, to persist history</description></item><item><title>Building Ruby 1.8.6 with Openssl 1 on Arch</title><link>https://www.gmarik.info/blog/2010/building-ruby-1.8.6-with-openssl-1-on-arch/</link><pubDate>Fri, 16 Apr 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/building-ruby-1.8.6-with-openssl-1-on-arch/</guid><description>If you got this error
ossl_ssl.c: In function &amp;#39;ossl_sslctx_get_ciphers&amp;#39;: ossl_ssl.c:444:19: error: &amp;#39;STACK&amp;#39; undeclared (first use in this function) ossl_ssl.c:444:19: note: each undeclared identifier is reported only once for each function it appears in ossl_ssl.c:444:25: error: expected expression before &amp;#39;)&amp;#39; token ossl_ssl.c:447:47: error: expected expression before &amp;#39;)&amp;#39; token ossl_ssl.c:447:47: error: too few arguments to function &amp;#39;sk_value&amp;#39; /usr/include/openssl/stack.h:80:7: note: declared here ossl_ssl.c: In function &amp;#39;ossl_ssl_get_peer_cert_chain&amp;#39;: ossl_ssl.c:794:5: warning: passing argument 1 of &amp;#39;sk_num&amp;#39; from incompatible pointer type /usr/include/openssl/stack.</description></item><item><title>Ruby `retry` keyword and name clash</title><link>https://www.gmarik.info/blog/2010/ruby-retry-keyword-and-name-clash/</link><pubDate>Tue, 02 Mar 2010 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2010/ruby-retry-keyword-and-name-clash/</guid><description>Lets check out ruby snippet:
class A def retry_me puts &amp;#39;retry me called&amp;#39; raise unless @r rescue @r = 1 retry end end A.new.retry_me It produces:
$ ruby retry.rb retry me called retry me called What happens if retry method gets added?
class A def retry puts &amp;#39;retry called&amp;#39; end def retry_me puts &amp;#39;retry me called&amp;#39; raise unless @r rescue @r = 1 retry end end A.new.retry_me Luckily, ruby is smart enough to remember that retry is a keyword, producing same result</description></item><item><title>Vim doesnt' copy/paste from X11 clipboard</title><link>https://www.gmarik.info/blog/2009/vim-doesnt-copy-paste-from-x11-clipboard/</link><pubDate>Mon, 12 Oct 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/vim-doesnt-copy-paste-from-x11-clipboard/</guid><description>It was too frustating when I couldnt copy/paste to/from vim.
$ vim --version|grep clipb +clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +xsmp_interact -xterm_clipboard -xterm_save As you can see vim has disabled clipboard and xterm clipboard modules.
Luckily it can be fixed easilly by installing gvim on Arch like
$ sudo pacman -S gvim Lets check now:
$ vim --version|grep clipb +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +xsmp_interact +xterm_clipboard -xterm_save Modules present and copy/paste works fine!</description></item><item><title>Ruby's rmagick.so error</title><link>https://www.gmarik.info/blog/2009/rmagick-ruby-library-error/</link><pubDate>Thu, 24 Sep 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/rmagick-ruby-library-error/</guid><description>Arch is cool but you should never panic! )
After Arch&amp;rsquo;s rmagick library update I got my ruby bindings broken!
$ script/console ... Exiting /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.14/lib/RMagick.so: This version of RMagick was created to run with ImageMagick 6.5.4 (RuntimeError) but ImageMagick 6.5.6-1 is installed on this system. You should either 1) Configure and build RMagick for ImageMagick 6.5.6-1, or 2) download ImageMagick 6.5.4 from file:///usr/share/doc/ImageMagick-6.5.4/index.html and install it. So lets try to reinstall</description></item><item><title>Readline-6 update and Ruby issues</title><link>https://www.gmarik.info/blog/2009/ruby-readline-5-missing/</link><pubDate>Tue, 07 Jul 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/ruby-readline-5-missing/</guid><description>I had a ruby&amp;rsquo;s readline.so built against readline-5. After I got my Arch updated to readline-6 - got an error:
$ ./script/console Loading development environment. /usr/lib/ruby/1.8/i686-linux/readline.so: libreadline.so.5: cannot open shared object file: No such file or directory - /usr/lib/ruby/1.8/i686-linux/readline.so (LoadError) from /usr/lib/ruby/1.8/irb/completion.rb:10 from /usr/lib/ruby/1.8/irb/init.rb:252:in `require' from /usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules' from /usr/lib/ruby/1.8/irb/init.rb:250:in `each' from /usr/lib/ruby/1.8/irb/init.rb:250:in `load_modules' from /usr/lib/ruby/1.8/irb/init.rb:21:in `setup' from /usr/lib/ruby/1.8/irb.rb:54:in `start' from /usr/bin/irb:13 So I rebuild my ruby from sources with readline-6</description></item><item><title>Git push default</title><link>https://www.gmarik.info/blog/2009/git-push-default/</link><pubDate>Thu, 18 Jun 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/git-push-default/</guid><description>One day I got an error:
$ git push warning: You did not specify any refspecs to push, and the current remote warning: has not configured any push refspecs. The default action in this warning: case is to push all matching refspecs, that is, all branches warning: that exist both locally and remotely will be updated. This may warning: not necessarily be what you want to happen. warning: warning: You can specify what action you want to take in this case, and warning: avoid seeing this message again, by configuring 'push.</description></item><item><title>Virtual Box guest OS startup issues</title><link>https://www.gmarik.info/blog/2009/virtual-box-guest-os-startup-issues/</link><pubDate>Mon, 15 Jun 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/virtual-box-guest-os-startup-issues/</guid><description>$ VirtualBox --help Sun VirtualBox Graphical User Interface 2.2.4_OSE installed with pacman Kernel Module If you don&amp;rsquo;t have kernel module loaded you&amp;rsquo;ll get error:
Cannot access the kernel driver! The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Re-setup the kernel module by executing '/etc/init.d/vboxdrv setup' as root. Users of Ubuntu, Fedora or Mandriva should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.</description></item><item><title>Time.parse and rubygems-1.3.3 issue</title><link>https://www.gmarik.info/blog/2009/time.today-rubygems-issue/</link><pubDate>Tue, 12 May 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/time.today-rubygems-issue/</guid><description>I was starting rails app and got error
NoMethodError (undefined method `today&amp;#39; for Time:Class) Wtf? Just recently everything was fine&amp;hellip;
To investigate I downgraded my rubygems-1.3.3 to rubygems-1.3.1 As that was the only thing updated over the weekend
Then run
$ grep -B 1 -A 5 'def Time.today' -nR /usr/lib/ruby/site_ruby/ if RUBY_VERSION &amp;lt; &amp;#39;1.9&amp;#39; then def Time.today t = Time.now t - ((t.to_f + t.gmt_offset) % 86400) end unless defined? Time.</description></item><item><title>The Building Blocks of Modularity by Jim Weirich</title><link>https://www.gmarik.info/blog/2009/jim-weirich-the-building-blocks-of-modularity/</link><pubDate>Sun, 12 Apr 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/jim-weirich-the-building-blocks-of-modularity/</guid><description/></item><item><title>Gnome-Shell installation</title><link>https://www.gmarik.info/blog/2009/gnome-shell-installation/</link><pubDate>Fri, 10 Apr 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/gnome-shell-installation/</guid><description>http://live.gnome.org/GnomeShell#building
$ curl -O http://git.gnome.org/cgit/gnome-shell/plain/tools/build/gnome-shell-build-setup.sh $ /bin/bash gnome-shell-build-setup.sh $ jhbuild build Current branch master is up to date. *** Configuring gobject-introspection *** [1/6] ./autogen.sh --prefix /home/gmarik/gnome-shell/install --libdir '${exec_prefix}/lib' --disable-static --disable-gtk-doc You need to install the gnome-common module and make sure the gnome-autogen.sh script is in your $PATH. *** error during stage configure of gobject-introspection: ########## Error running ./autogen.sh --prefix /home/gmarik/gnome-shell/install --libdir '${exec_prefix}/lib' --disable-static --disable-gtk-doc *** [1/6] $ sudo pacman -S gnome-common checking for gtk-doc &amp;gt;= 1.</description></item><item><title>Linode setup log</title><link>https://www.gmarik.info/blog/2009/linode-setup-log/</link><pubDate>Thu, 05 Feb 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/linode-setup-log/</guid><description>this commands are performed in lish - a &amp;ldquo;linode shell&amp;rdquo;
Update Ubuntu $ apt-get update SSH $ apt-get install sshd $ apt-get install sysv-rc-conf $ vi /etc/ssh/sshd_config # Disable root login # Change default port to something else $ /etc/init.d/ssh restart $ netstat -anp # make sure we have sshd up and running Now we can ssh to the machine itself
Development tools $ sudo apt-get install ubuntu-standard $ sudo apt-get install language-pack-en $ sudo apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev $ apt-get install bash # i'm using it :) Setup simple UFW firewall $ sudo ufw status $ sudo ufw default deny $ sudo ufw allow from any to any port 80 $ sudo ufw allow from any to any port 17777 # my obscure ssh port $ sudo ufw enable User $ useradd -m -s /bin/bash $ passwd gmarik $ usermod -a -G admin gmarik Public key ssh login $ su - gmarik # become usual user $ mkdir ~/.</description></item><item><title>Apache server FQDN warning</title><link>https://www.gmarik.info/blog/2009/apache-server-fully-qualified-domain-name-warning/</link><pubDate>Wed, 04 Feb 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/apache-server-fully-qualified-domain-name-warning/</guid><description>Had this issue on Ubuntu/Debian linux:
$ sudo /etc/init.d/apache2 reload * Reloading web server config apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName Fix is pretty trivial:
$ sudo sh -c 'echo &amp;quot;ServerName localhost.localdomain&amp;quot; &amp;gt; /etc/apache2/conf.d/server_name' $ sudo /etc/init.d/apache2 reload * Reloading web server config apache2 [ OK ]</description></item><item><title>Gems update --system error</title><link>https://www.gmarik.info/blog/2009/gem-update-system-error/</link><pubDate>Tue, 03 Feb 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/gem-update-system-error/</guid><description>$ gem -v 1.2.0 $ sudo gem update --system Updating RubyGems Updating rubygems-update Successfully installed rubygems-update-1.3.1 ERROR: While executing gem ... (NameError) undefined local variable or method `remote_gemspecs' for #&amp;lt;Gem::Commands::UpdateCommand:0xb79f00bc&amp;gt; $ gem -v 1.2.0 $ sudo gem update --system Updating RubyGems Nothing to update $ sudo gem install rubygems-update --debug Exception `NameError' at /usr/local/lib/ruby/site_ruby/./rubygems/command_manager.rb:134 - uninitialized constant Gem::Commands::InstallCommand Exception `Gem::LoadError' at /usr/local/lib/ruby/site_ruby/./rubygems.rb:578 - Could not find RubyGem sources (&amp;gt; 0.0.1) Exception `IOError' at /usr/local/lib/ruby/site_ruby/.</description></item><item><title>New blog</title><link>https://www.gmarik.info/blog/2009/new-blog/</link><pubDate>Sat, 31 Jan 2009 00:00:00 +0000</pubDate><guid>https://www.gmarik.info/blog/2009/new-blog/</guid><description>Hello world! :)
I have started new blog, and my new tools are:
Vim as editing environment Markdown with Maruku for content Jekyll for site engine Git as a backend and deployment tool Blog needs styling and looks but i&amp;rsquo;ll be doing it while moving along&amp;hellip;
Also I plan to convert old but popular entries from my old blog
Stay tuned! :)</description></item></channel></rss>