Skip to content

Instantly share code, notes, and snippets.

@mydiemho
mydiemho / RestoreAppleM1.md
Last active May 11, 2023 13:26
Apple M1 MacBook Support
The [instruction](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#docker)
for mounting is confusing so adding extra info on how to run it
1. Download `swagger-ui` [Docker image](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#docker)
```bash
docker pull swaggerapi/swagger-ui
```
1. Make sure you're in the directory that contains `swagger.json`
@mydiemho
mydiemho / gist:8f2d2e501e177110db64450d638d1b4b
Last active July 26, 2017 00:12
arduino + raspberry hack
# import serial
import requests
import time
import json
url = 'https://outlook.office.com/webhook/db2a1545-a674-485a-b5df-44171ce2238b@72f988bf-86f1-41af-91ab-2d7cd011db47/IncomingWebhook/9984b53e97594d888dfbdad5102d0bbc/3627016e-c8b7-4bf2-9614-234f99bc4d0f'
# ser = serial.Serial('/dev/ttyACM0', 9600)
# ser.flushInput()
@mydiemho
mydiemho / gist:98a8340438a2ef326b36dacb17da08cd
Created July 17, 2017 22:09 — forked from jmtame/gist:6458832
ruby blocks and yield explained by a bloc mentor

The following is an explanation of Ruby blocks and yield by another Bloc mentor (Adam Louis) who was trying to explain it to one of his students.

On my very first day programming, if someone asked me for "the sum of the numbers from 1 to 10", I'd have written:

puts 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10

Easy enough.

@mydiemho
mydiemho / gist:91fb262c0ba68b2d1b89b4ab72180e0f
Created November 4, 2016 20:04 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mydiemho
mydiemho / fizzbuzz_modulo.py
Created June 30, 2016 04:48 — forked from curtisforrester/fizzbuzz_modulo.py
Python FizzBuzz with modulo comparisons
import cProfile
import pstats
import StringIO
pr = cProfile.Profile()
pr.enable()
iNot = set()
iFizz = set()
iBuzz = set()
@mydiemho
mydiemho / fizzbuzz_sets.py
Created June 30, 2016 04:47 — forked from curtisforrester/fizzbuzz_sets.py
Python FizzBuzz with lookup sets
import cProfile
import pstats
import StringIO
pr = cProfile.Profile()
pr.enable()
threes = {num for num in range(3, 100, 3)}
fives = {num for num in range(5, 100, 5)}
not_in = {num for num in range(1, 100) if num not in threes and num not in fives}