Skip to content

Instantly share code, notes, and snippets.

Avatar
😻
Happy

Steffen Uhlig suhlig

😻
Happy
  • IBM
  • Cloud
View GitHub Profile
@suhlig
suhlig / defined.rb
Created Jun 1, 2016
Side effect of defined?
View defined.rb
$ pry
pry> foo
NameError: undefined local variable or method `foo' for main:Object
pry> if defined?(foo)
* bar = 1
* end
=> nil
pry> if defined?(bar)
* puts "oops"
* end
@suhlig
suhlig / parse-cc-logs
Last active Jun 24, 2016
Parsing cloud controller logs with jq (also converts time stamps to be human-readable)
View parse-cc-logs
cat cloud_controller_ng.log | jq -r '{timestamp: .timestamp|todate, source, message, loc: [.file, .lineno|tostring] | join(":")} | join(" - ")'
@suhlig
suhlig / keybase.md
Created May 12, 2017
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am suhlig on github.
  • I am suhlig (https://keybase.io/suhlig) on keybase.
  • I have a public key ASCmKYO26B9hxHc0EXQJzoS4a_NQLrdDiNE3J_BT40XrNQo

To claim this, I am signing this object:

View chip-freifunk-monitor.md

Freifunk is Down

Log on

  1. Connect the C.H.I.P. via USB to a Mac and execute screen /dev/tty.usbmodem*. It will bring up a serial console (via USB).
  2. Log on (you may have to press Enter before that, so that the login prompt appears)
  3. When done, exit with Control-a, Control-d (where Control-a is the prefix).

Check the WiFi connection

@suhlig
suhlig / gist:89e1cbb183eacb33af6070669cc0eb3e
Last active Nov 1, 2017
Multi-line fenced code blocks fail in numbered lists
View gist:89e1cbb183eacb33af6070669cc0eb3e
1. This does not work:
```
$ some command
$ some other command
```
1. This, however, does work fine (note the alignment of 'This' with the block using an extra space):
@suhlig
suhlig / cf-app-lifecycle.markdown
Created Dec 8, 2017
Presentation on the Cloud Foundry Application Lifecycle
View cf-app-lifecycle.markdown

Cloud Foundry Application Lifecycle

Abstract

What happens between cf push and "state: running"? We will have a look at how the Cloud Foundry part of the IBM Cloud creates and manages applications. Attending this session will give you an in-depth understanding of application deployment works and where to look in case of trouble. (edited)

Happy Day

cd ~/workspace/cf-acceptance-tests/assets/dora
@suhlig
suhlig / install-tmux
Last active Apr 13, 2021 — forked from philipsd6/install-tmux
Install tmux on rhel/centos
View install-tmux
# Install tmux on rhel/centos 7
# What do we want?
libeventversion=2.1.11
tmuxversion=3.1
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
View imagemagick.txt
2colorthresh - Automatically thresholds an image to binary (b/w) format using an adaptive spatial subdivision color reduction technique
3Dbox - Generates a perspective view of a 3D box at any orientation with pictures pasted on each of its sides
3Dcover - Wraps an image around the front and left or right side of box viewed in rotated perspective
3Dreflection - Adds a fading reflection below an image and views it in perspective
3Drotate - Applies a perspective distortion to an image by providing three rotation angles, zoom, offsets, background color, perspective exaggeration and auto zoom/centering 3Dtext - Converts text into an image with a 3D extrusion effect accentedges - Applies accented edges to an image
adaptivegamma - Enhances the contrast/brightness in an image using a locally adaptive gamma method
anglegradient - Creates a gradient effect at a specific orientation angle
aspect - Resizes an image to a specific size allowing either cropping or padding to deal with the aspect ratio change
aspectcrop - Cr
@suhlig
suhlig / inline-erb.rb
Last active Jul 20, 2018
'Blocky' ERB syntax
View inline-erb.rb
require 'erb'
class UserTemplate
def initialize(user)
@user = user
end
def to_s
# In the ERB template, we can refer to all instance variables, etc. due to
# the binding being passed.
@suhlig
suhlig / cf-all-apps
Created Jun 29, 2019
List all cf apps across all orgs and spaces
View cf-all-apps
#!/usr/bin/env ruby
require 'json'
require 'shellwords'
HIERARCHY = %w(/ org space app)
def curl(url)
while url
JSON.parse(`cf curl #{Shellwords.escape(url)}`).tap do |result|