Skip to content

Instantly share code, notes, and snippets.

View mohoromitch's full-sized avatar
🌇
🎉

Mitchell Mohorovich mohoromitch

🌇
🎉
View GitHub Profile
@Treeki
Treeki / TurnipPrices.cpp
Last active April 5, 2024 13:55
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@brianfoody
brianfoody / DeadLetterQueueStack.ts
Last active March 16, 2024 21:47
Dead Letter Queue example with CDK
import { Queue } from "@aws-cdk/aws-sqs";
import { App, Duration, Stack, StackProps } from "@aws-cdk/core";
import { Runtime, Code, Function } from "@aws-cdk/aws-lambda";
import { SqsEventSource } from "@aws-cdk/aws-lambda-event-sources";
class DeadLetterQueue extends Stack {
constructor(parent: App, name: string, props?: StackProps) {
super(parent, name, props);
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active March 15, 2024 14:13
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py
@max-mapper
max-mapper / bibtex.png
Last active March 10, 2024 21:53
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@pdincau
pdincau / readme.md
Last active April 1, 2024 14:22
Study Path on microservices
@lukasbesch
lukasbesch / disk-conversion-progress.sh
Last active March 31, 2022 15:52
View progress of long-running disk conversion tasks (en-/decryption) on macOS / OS X
function displaytime {
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
(( $D > 0 )) && printf '%3s' $D && printf ' days '
(( $H > 0 )) && printf '%2s' $H && printf ' hours '
(( $M > 0 )) && printf '%2s' $M && printf ' minutes '
if [ $D -lt 1 -a $H -lt 1 ]
@sarciszewski
sarciszewski / README.md
Created May 30, 2015 04:25
A Crusade Against Bad Code

Aniruddh Agarwal blogged A short tour of PHP, and this is one of the negatives he identified:

Community: I know. I said that PHPs community was an advantage to it, but it is also a disadvantage, because of BAD CODE. Beginners are not taught the best practices and they go on to write bad code and distribute it, either as answers on Stack Overflow or similar websites or blog about it, which encourages other beginners to adopt those practices. There is a lot of misinformation out there, and it is very difficult to separate the good from the bad. This is perhaps the worst thing about PHP, because PHP is an entry-level language and people learning it are usually not aware of the best practices.

This is spot on!

The existence of BAD CODE being copied and pasted by newcomers is probably the biggest source of exploitable security vulnerabilities in the entire industry.

The biggest offenders are often the highest ranking search results on Google and other search eng

@demisx
demisx / syntax.css
Last active February 20, 2020 04:32
Syntax highlighter CSS file
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@evansims
evansims / hooks.php
Last active May 20, 2020 19:27
An example of automatically including header and footer templates using Slim hooks.
$app->hook('slim.before.dispatch', function () use ($app) {
$app->render('/views/header.php');
});
$app->hook('slim.after.dispatch', function () use ($app) {
$app->render('/views/footer.php');
});