Skip to content

Instantly share code, notes, and snippets.

View armanm's full-sized avatar

Arman Mirkazemi armanm

View GitHub Profile
@armanm
armanm / application_controller.rb
Last active October 28, 2022 11:42
Better isolation of controllers testing without using instance variables and checking assigns in specs
class ApplicationController < ActionController::Base
private
def on_error_render(action, assigns = nil)
yield
rescue StandardError
render action, assigns:, status: :internal_server_error
end
end
@armanm
armanm / spec.yml
Created December 30, 2020 08:12
DigitalOcean App Platform with container registry and image spec example
name: arman-test
region: nyc3
services:
-
name: nginx
image:
registry_type: DOCR
repository: my-nginx
tag: latest
instance_size_slug: basic-xxs
### Keybase proof
I hereby claim:
* I am armanm on github.
* I am armanm (https://keybase.io/armanm) on keybase.
* I have a public key ASC-XaP4f1JzdXQ6jzTodTsDgN2GmBYapK9Dajt2NeuEigo
To claim this, I am signing this object:
```json
{
"body": {
"key": {

@melissasoding @grassdog I've looked at messaging done by others using HIBP and here is what stands out to me:

  • they all appear to block users from using pwned password
  • some delay mentioning HIBP like Kogan
  • or they show it right away like EVE and a few others

I see no info on whether linking to HIBP as part of an error message makes for a distraction that takes users away from the funnle but my gut feeling is to want to delay talking about HIBP and linking to them to avoid that. So my suggestion are:

  • block any pwned password even ones with a pwned count of <= 10 – I'm coming around to suggestions from the architecture guild folks to not allow any pwned passwords in the system. My thinking is if a hacker is serious about getting into an account they will probably check if it appears in breach data and they, more than likely, will try any leaked passwords against that account. In addition, I can not spot a service that warns users about choosing pwned password but not block them.
# encoding: utf-8
# This helper makes hash keys accessable via simple methods.
# This behaviour allows to treat hash elements as object
# properties that can also be overriden
#
# When set_params_hash is not called, then by default this
# code will look for a params method on the object
#
# class TestingClass

Force Nginx to server the latest version of the static file when running in VirtualBox

If this does not work, and you're running nginx on a virtual machine in VirtualBox, it may be sendfile() that is causing the trouble. Simply comment out the sendfile directive or set it to "off". The directive is most likely found in your nginx.conf file.

sendfile off;

How to restart VirtualBox on OSX

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

How to rename local git branches

rename local branch

git branch -m old-branch-name new-branch-name

delete remote branch with old name

git push origin :old-branch-name

How to activate mod_rewrite for Apache

sudo a2enmod rewrite

How to view open files:

the lsof command lets you view all files that are currently open by some program

lsof 

to view open files that are deleted run:

lsof | grep deleted