Skip to content

Instantly share code, notes, and snippets.

View ksylvan's full-sized avatar

Kayvan Sylvan ksylvan

View GitHub Profile
@ksylvan
ksylvan / BashGitCompletionForMac
Last active March 24, 2016 17:27
bash completion for git for Mac OSX
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# brew install bash-completion git git-extras git-flow
# Then add the following snippet to your .bash_profile
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -d $(brew --prefix)/bin ]; then
PATH=$(brew --prefix)/bin:$PATH
fi
@ksylvan
ksylvan / keybase.md
Created August 18, 2016 16:27
Keybase identity declaration

Keybase proof

I hereby claim:

  • I am ksylvan on github.
  • I am ksylvan (https://keybase.io/ksylvan) on keybase.
  • I have a public key whose fingerprint is 30E9 AE71 105E CF9C 40C4 A95D 3822 6E74 4D57 96BA

To claim this, I am signing this object:

@ksylvan
ksylvan / hackMavenSettings.yml
Created March 24, 2017 21:20
Hack Maven's ~/.m2/settings.xml to add a new profile and its properties.
# MVN IDEA settings
#
---
- hosts: all
gather_facts: false
roles:
- cmprescott.xml
vars:
- m2_settings_file: ~/.m2/settings.xml
tasks:
@ksylvan
ksylvan / GitLab
Created May 22, 2017 20:17
Gitlab runner for VM
#!/bin/sh
#
#IMAGE=gitlab/gitlab-ce:previous
IMAGE=gitlab/gitlab-ce
NAME=gitlab
PORTS="-p 443:443 -p 80:80 -p 22:22"
G_CONFIG=/etc/gitlab
@ksylvan
ksylvan / ansible-run.txt
Created August 4, 2017 17:58
Nice idempotence checking by Ansible. The first playbook is `bootstrap.yml` and the second is `mailserver.yml`
kayvan@thor mail-server:(master)$ make redo
ansible-playbook -u deploy bootstrap.yml
PLAY [all] ********************************************************************************************
TASK [Install python 2 if not there] ******************************************************************
ok: [netconnect.net]
TASK [Install sudo if not there] **********************************************************************
ok: [netconnect.net]
@ksylvan
ksylvan / letsencrypt.log
Last active August 23, 2017 04:06
LE fails
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', 'postmaster@sylvan.com', '-d', 'spam.sylvan.com', '-d', 'mail.sylvan.com', '-d', 'postfixadmin.sylvan.com', '-d', 'sylvan.com', '-d', 'webmail.sylvan.com', '-d', 'www.sylvan.com']
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
ksylvan / pihole_config.sh
Last active November 28, 2019 09:42
Pi-Hole Config for pi-hole in Docker container
#!/bin/bash
#
# After you start your Pi-Hole in a Docker container according
# to this: https://github.com/diginc/docker-pi-hole
#
# 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:

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
ksylvan / calc.py
Last active March 13, 2020 23:50
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.
@ksylvan
ksylvan / main.py
Last active March 18, 2020 06:27
OurString and hasNext and getNext
#
#
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
# | | | |
# |H| |L| |W| |D|
# |E| |O| |O| |!|
# |L| |R|
# |L|
#