Skip to content

Instantly share code, notes, and snippets.

View jameswritescode's full-sized avatar
✍️
we vibing now

James Newton jameswritescode

✍️
we vibing now
View GitHub Profile

carina installation checklist

language related

php

  • php

python

  • python
  • pip
#include "person.h"
int main(int argc, const char *argv[])
{
person_t james = {"James", "Newton", 21};
person_print(james);
return 0;
}

This is the third part of my [Learning code by comparison][1] series of learning C with explanations in Ruby.

It's always normal when writing a library, application, or other things in Ruby to use multiple files. It's common to do this with C too, but since we compile it's not as simple as our typical require.

To start off our Ruby example we'll create a Person module with common methods we'll want to include in our James class. This would allow us to give James extra methods that are unique to that class.

module Person
  def full_name
    "#{@first_name} #{@last_name}"

Keybase proof

I hereby claim:

  • I am jameswritescode on github.
  • I am newton (https://keybase.io/newton) on keybase.
  • I have a public key whose fingerprint is D02D 3073 D8FA 7811 1860 1187 FB88 2A20 ED0C 12D2

To claim this, I am signing this object:

require 'cocaine'

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>gutterSettings</key>
<dict>
describe 'imageDrop', ->
element =
$scope =
beforeEach inject ($rootScope, $compile) ->
$scope = $rootScope
element = angular.element('<image-drop></image-drop>')
$compile(element)($rootScope)
$scope.$digest()
require 'centarra'
manager = Centarra::Manager.new
manager << Centarra::Account.new(name: 'carina', username: 'honk', key: 'honk')
manager << Centarra::Account.new(name: 'orion', username: 'honk', key: 'honk')
manager['carina'].vps_list
manager['carina'].signup 'huehue'
manager['orion'].dns # returns Centarra::DNS stuff, or whatever
<script>
var script = document.createElement('script');
script.src = "//example.com";
document.getElementsByTagName('head')[0].appendChild(script);
</script>
<script async src="//example.com"></script>