Skip to content

Instantly share code, notes, and snippets.

@rwanyoike
rwanyoike / mwenja-solution.py
Last active Oct 10, 2020
Solution to 'minimum number of of edits needed to assert r'A+B+'
View mwenja-solution.py
# Solve: minimum number of 'edits' needed to assert r'A+B+' in <string>
def main(string):
# count of total A's, B's
totals = {"A": 0, "B": 0}
# count of A's, B's seen (in second loop) (does not include edits)
total_seen = {"A": 0, "B": 0}
# solution/answer
solution = 0
@rwanyoike
rwanyoike / utils.py
Created Jun 10, 2020
Solarwinds 06 Session - RSK - 5Z4
View utils.py
import folium
def generate_beacon_map():
kenya = folium.Map(
location=[-1.28333, 36.81667],
zoom_start=12,
# width=400,
# height=300,
control_scale=True,
View settings.json
{
"editor.emptySelectionClipboard": false,
"editor.fontFamily": "Hack, Monospace",
"editor.fontLigatures": true,
"editor.renderControlCharacters": true,
"editor.renderIndentGuides": true,
"editor.renderWhitespace": "all",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"files.insertFinalNewline": true,
View New macOS Setup.md

New macOS Setup

  1. Install any available software updates
  2. Enable software update checks
  3. Disable automatic software update downloads
  4. Enable Guest User
  5. Install command line developer tools xcode-select --install
  6. Install homebrew
  7. Setup the dotfiles repo
  8. Install the BrewFile (in dotfiles repo)
View gist:91bf357856508a163b846410ded3333d
defaults write com.apple.dock tilesize -int 44
defaults write NSGlobalDomain NSWindowResizeTime -float 0.1
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write org.n8gray.QLColorCode fontSizePoints 9
defaults write org.n8gray.QLColorCode extraHLFlags '-l'
View aggregatorNotes.json
{
"title": "Building Awesome CMS",
"content": "<div><div><div class=\"section-content\"><div class=\"section-inner sectionLayout--insetColumn\"><figure id=\"1b95\" class=\"graf graf--figure graf-after--h3\"><img class=\"progressiveMedia-noscript js-progressiveMedia-inner\" src=\"https://cdn-images-1.medium.com/max/800/1*zo51eqdjJ_XSU0D8Vm8P9A.png\"></figure><p id=\"c21b\" class=\"graf graf--p graf-after--figure\"><a href=\"https://github.com/postlight/awesome-cms\" class=\"markup--anchor markup--p-anchor\">Awesome CMS</a> is&#x2026;an awesome list of awesome CMSes. It&#x2019;s on GitHub, so anyone can add to it via a pull request. Here are some notes on how and why it came to be.</p><p id=\"2a96\" class=\"graf graf--p graf-after--h3\">GitHub has a <a href=\"https://help.github.com/articles/search-syntax/\" class=\"markup--anchor markup--p-anchor\">set of powerful commands</a> for narrowing search results. In seeking out modern content management tools, I used queries like this:</p><p id=\"5c79\" class=\"g
@rwanyoike
rwanyoike / appears_in.py
Created Sep 9, 2017
Code Test: Given an array of ints, return True if the sequence.. 1, 3, 4 .. appears in the array somewhere.
View appears_in.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Given an array of int's, return True if the sequence.. 1, 3, 4 .. appears in
# the array somewhere.
# O(len(haystack)) || Ω(len(needle))
def appears_in(haystack: list, needle: list) -> bool:
""" Return True if `needle` appears in `haystack`.
View macos.sh
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
@rwanyoike
rwanyoike / packages.py
Created May 28, 2017
Download and parse Unihan and CEDICT files into memory (use BasePackage.rows)
View packages.py
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from gzip import GzipFile
from zipfile import ZipFile
import hashlib
import os
import re
import shutil
@rwanyoike
rwanyoike / cloudSettings
Last active Sep 4, 2018
Visual Studio Code Sync Settings Gist
View cloudSettings
{"lastUpload":"2018-09-04T17:57:54.289Z","extensionVersion":"v3.1.2"}