Skip to content

Instantly share code, notes, and snippets.

Joakim Kolsjö joakimk

Block or report user

Report or block joakimk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joakimk
joakimk / pxe_server_install.sh
Created Oct 12, 2010
Script to install a PXE boot server for diskless clients
View pxe_server_install.sh
# This installs a PXE boot server.
#
# It's based on https://help.ubuntu.com/community/DisklessUbuntuHowto.
# It's been used with ubuntu-10.10-server-amd64.iso and ubuntu-10.10-server-i386.iso.
#
# It requires two network cards. One for access to the outside world and one
# for a private network of PXE clients. I've choosen this setup to not cause problems
# with DHCP on the normal network.
#
# It also requires that you have a second partition mounted on /nfsroot.
@joakimk
joakimk / README.md
Last active Jun 10, 2019
CircleCI elixir build example
View README.md

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

@joakimk
joakimk / cpu_test.md
Last active Jun 3, 2019
Single core cpu performance test
View cpu_test.md

Single core cpu performance.

echo 'int main() { double i = 0; for(i = 0; i < 5000000000; i++) { 20%7 * i; } }' > /tmp/test.c && gcc /tmp/test.c -o /tmp/test && time /tmp/test && rm /tmp/test.c && rm /tmp/test

NOTE: It's not 100% reliable since it differs depending on compiler version.

Platform                   CPU                   Time
MacBookPro15,1 (Mid 2018)  i9 2.4 ghz            11.1 
iMac15,1 (Late 2014)       i7 4.0 ghz            11.7
PC                         i7 4.0 ghz (OC)       12.2 (our CI box)
@joakimk
joakimk / notes.md
Last active Mar 19, 2019
Building custom ruby images to use the latest versions (e.g. to get security fixes earlier)
View notes.md

Building custom ruby-alpine

Check the alpine version of the previous image.

alpine3.9 master$ docker run -it ruby:2.5.4-alpine sh
/ # cat /etc/alpine-release 
3.9.2
/ # ruby -v
ruby 2.5.4p155 (2019-03-13 revision 67245) [x86_64-linux-musl]
@joakimk
joakimk / webpacker-environment.js
Last active Oct 11, 2018
non-digested assets in webpack (e.g. non-stupid-digest-assets for webpacker)
View webpacker-environment.js
// Didn't find anything on google for this so I wrote my own. Use as a starting point if you have a similar problem.
// Please write comments if there is a better way to do this (or solve the same problem in another way) in webpack.
// Contents of config/webpack/environment.js:
const { environment } = require('@rails/webpacker')
// Generate undigested assets for use in embedded javascript, emails, etc.
// We previously used non-stupid-digest-assets for this.
@joakimk
joakimk / init.coffee
Last active Apr 5, 2018
Running tests in tmux from Atom
View init.coffee
# Atom -> Init Script...
child = require "child_process"
runTestInTmux = (focus) ->
editor = atom.workspace.getActiveTextEditor()
editor.save()
fullPath = editor.getPath()
projectPath = atom.project.getDirectories()[0].getPath() + "/"
@joakimk
joakimk / pipeline.md
Last active Mar 18, 2018
How we made our commit to production time twice as fast using heroku pipelines
View pipeline.md

Background

We started out with two apps.

  • foo-staging
  • foo-production

Our CI would run tests, then deploy to staging, run smoke tests and then run to production and run smoke tests.

This took about 22-25 min.

@joakimk
joakimk / File.md
Created Sep 11, 2016
heroku: Could not connect to database to initialize transfer
View File.md

If you're seeing this error, try heroku ps:scale web=0 then import the database again and run heroku ps:scale web=1 afterwards. Found nothing on google for this error, so posting this gist with the solution that worked for me. Could have been a temporary error too.

@joakimk
joakimk / elm-and-atom.md
Last active Nov 20, 2017
Elm and Atom setup
View elm-and-atom.md

Some notes on my Elm development environment.

The most important thing is elm-format. It auto-formats the code when you save. You will likely miss this in other languages.

  1. brew install elm elm-format
  2. Install Atom
  3. Elm plugins: elm-format language-elm
  4. Vim plugins: ex-mode vim-mode-plus

Currently evaluating the elmjutsu plugin.

You can’t perform that action at this time.