Skip to content

Instantly share code, notes, and snippets.

ksylvan / How-to-Symbolize-MacOSX-Crash-Dump
Created Dec 9, 2020 — forked from jerrykrinock/How-to-Symbolize-MacOSX-Crash-Dump
How to symbolize a crash dump in Mac OS X, given a crash dump or exception log. Includes some steps and tips I've collected that are missing in Apple's TN2123. One time I tried this using lldb instead of gdb but it didn't work.
View How-to-Symbolize-MacOSX-Crash-Dump
1) Move/copy both the crashing .app and the relevant.dSYM files into the same directory.
2) If the crash was in a framework, dynamic library, or bundle, you have position-independent code and must work out the *slide*. Otherwise, skip up to step 9 and use slide=0.
3a) If you have a crash dump, look in the *Binary Images* part of the crash log and find the framework, dynamic libray or bundle in which the crash occurred. Read the first column of the output. This is the address at which the __TEXT segment was loaded. We call it the *Actual Load Address* and denote it as *A*.
ksylvan /
Last active Jun 11, 2020
from random import randrange
class MinesGrid:
# Implement a sparse array to optimize space.
MINE = -1
class Row:
# Each row in the __a dict has the following
# structure a list, containing:
# [ empty_cells, {} ]
ksylvan /
Last active May 4, 2020
Euler 17 in Python: Number to words
# 1 <= T <= 10
# 0 <= N <= 1e12
# 1e3 = Thousand
# 1e6 = Million
# 1e9 = Billion
# 1e12 = Trillion
# Project Euler 17
ksylvan /
Created Mar 28, 2020
Justified Text question
# Question Description: Write a function that takes, as arguments, an integer representing line length in
# characters and a (long) string of text and returns the text with spaces and line breaks to produce a block of
# text justified to the given line length. For example, if the function were called as
# justify(25, "This is some sample text, really just enough to generate a few lines in the output to show what the text justify function is supposed to do.")
# This is some sample text,
# really just enough to
# generate a few lines in
# the output to show what
ksylvan /
Last active Mar 18, 2020
OurString and hasNext and getNext
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
# | | | |
# |H| |L| |W| |D|
# |E| |O| |O| |!|
# |L| |R|
# |L|
ksylvan /
Last active Mar 13, 2020
Simple Calculator
# You are building an educational website and want
# to create a simple calculator for students to use.
# The calculator will only allow addition and subtraction
# of non-negative integers.
# We also want to allow parentheses in our input.
# Given an expression string using
# the "+", "-", "(", and ")"
# operators like "5+(16-2)", write a function to parse the
# string and evaluate the result.

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.

Effective Engineer - Notes

What's an Effective Engineer?

ksylvan /
Last active Nov 28, 2019
Pi-Hole Config for pi-hole in Docker container
# After you start your Pi-Hole in a Docker container according
# to this:
# NOTE: On the Mac, I had to add "-h $(scutil --get LocalHostName)" to
# the "docker run" command. Otherwise, the Mac hostname was being reset
# to the random hostname generated for the container.
# Run this to replicate Will's setup here:
View letsencrypt.log
2017-08-23 01:48:43,076:DEBUG:certbot.main:certbot version: 0.17.0
2017-08-23 01:48:43,077:DEBUG:certbot.main:Arguments: ['--expand', '--standalone', '--agree-tos', '--rsa-key-size', '4096', '-m', '', '-d', '', '-d', '', '-d', '', '-d', '', '-d', '', '-d', '']
2017-08-23 01:48:43,077:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2017-08-23 01:48:43,093:DEBUG:certbot.log:Root logging level set at 20
2017-08-23 01:48:43,094:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2017-08-23 01:48:43,095:DEBUG:certbot.plugins.selection:Requested authenticator standalone and installer None
2017-08-23 01:48:43,189:DEBUG:certbot.plugins.selection:Single candidate plugin: * standalone
Description: Spin up a temporary webserver
Interfaces: IAuthenticator, IPlugin
Entry point: sta
ksylvan / ansible-run.txt
Created Aug 4, 2017
Nice idempotence checking by Ansible. The first playbook is `bootstrap.yml` and the second is `mailserver.yml`
View ansible-run.txt
kayvan@thor mail-server:(master)$ make redo
ansible-playbook -u deploy bootstrap.yml
PLAY [all] ********************************************************************************************
TASK [Install python 2 if not there] ******************************************************************
ok: []
TASK [Install sudo if not there] **********************************************************************
ok: []