Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

OpenWrt/LEDE opkg Tips and Tricks

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
@rwanyoike
rwanyoike / mwenja-solution.py
Last active October 10, 2020 13:06
Solution to 'minimum number of of edits needed to assert r'A+B+'
# 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

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)
@rwanyoike
rwanyoike / appears_in.py
Created September 9, 2017 15:37
Code Test: Given an array of ints, return True if the sequence.. 1, 3, 4 .. appears in the array somewhere.
#!/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`.
{
"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 / correct_jap_mp3.py
Last active July 15, 2017 19:20
Correct Shift JIS encoded MP3s, and convert them to ID3 v2.4 while at it
#!/usr/bin/env python
import glob
import logging
import eyed3
def moolala(tag):
try:
return tag.encode("latin1").decode("shiftjis")
@rwanyoike
rwanyoike / huawei_unlock.py
Last active July 15, 2017 19:13
Calculates unlock codes for Huawei modems; see: https://github.com/mcphail/linux_huawei_unlocker
#!/usr/bin/env python
#
# Copyright 2010: dogbert <dogber1@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@rwanyoike
rwanyoike / sakis3g_orange.sh
Last active June 4, 2017 08:43
Sakis3G script to connect to a 2G/3G/4G network
#!/usr/bin/env bash
# Replace the **** strings
OTHER="CUSTOM_TTY" \
CUSTOM_TTY="/dev/ttyUSB1" \
APN="CUSTOM_APN" \
CUSTOM_APN="****" \
APN_USER="****" \
APN_PASS="****" \
sakis3g --console connect
@rwanyoike
rwanyoike / nano_development.txt
Created December 13, 2016 22:54
Keep track of nano development
database functions
[x] nano.db.create(name, [callback])
[x] nano.db.get(name, [callback])
[x] nano.db.destroy(name, [callback])
[x] nano.db.list([callback])
[x] nano.db.compact(name, [designname], [callback])
[x] nano.db.replicate(source, target, [opts], [callback])
[ ] nano.db.changes(name, [params], [callback])
[ ] nano.db.follow(name, [params], [callback])
@rwanyoike
rwanyoike / simple_ip_scan.sh
Last active August 29, 2015 14:23
Simple IP scan
#!/usr/bin/env bash
for ip in 192.168.0.{1..254}; do
ping -c 1 -W 1 $ip | grep "64 bytes" &
done