Skip to content

Instantly share code, notes, and snippets.

@kohigh
kohigh / rspec_model_testing_template.rb
Created December 29, 2016 16:48
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there.
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@kohigh
kohigh / Hackback
Created March 20, 2018 09:38 — forked from denji/Hackback
Nikto, NMap , Skipfish and friends http://www.security-marathon.be/?p=844
_ _ _ ____ _ _
| | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
| |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
| _ | (_| | (__| < | |_) | (_| | (__| <|_|
|_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
A DIY Guide for those without the patience to wait for whistleblowers
--[ 1 ]-- Introduction
@kohigh
kohigh / sms_messenger.example.yml
Created January 3, 2019 17:48
yml for configuring Twilio client connection
development:
:url: 'https://api.twilio.com/2010-04-01/Accounts/your_account_sid/Messages.json'
:auth_username: username
:auth_password: password
:phone_from: +1111111111
staging:
:url: 'https://api.twilio.com/2010-04-01/Accounts/your_account_sid/Messages.json'
:auth_username: username
:auth_password: password
@kohigh
kohigh / sms.rb
Created January 3, 2019 17:49
class for SMS objects
class SMS
attr_reader :phone
def self.configure(texts:, **args)
const_set('TEXTS', texts)
end
def initialize(type:, phone:, **attrs)
@type = type
@kohigh
kohigh / sms.yml
Created January 3, 2019 17:50
yml for configuring SMS texts
:texts:
registration: "Hello, %{name}! We are glad you are with us now! Sincerely yours, SMService!"
@kohigh
kohigh / app.rb
Created January 3, 2019 17:50
App initializer and destructor
module App
module Initializer
class << self
include EM::Deferrable
def load_app
#log that app loaded all files and ready to start from this point
succeed
end
end
@kohigh
kohigh / gist:746273eb69a8b308f21336346f541637
Created March 19, 2019 14:01
Ruby's performance tuning way
@kohigh
kohigh / golang-tls.md
Created November 25, 2021 19:00 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@kohigh
kohigh / wildcard_ssl_renew_letsencrypt_name_com.md
Created November 28, 2021 00:16 — forked from padeoe/README_wildcard_ssl_renew_letsencrypt_name_com.md
[Script]Renew letsencrypt wildcard ssl cert for domain on name.com

[Script]Renew Wildcard Certificates with Letsencrypt for domain hosted by Name.com

This tutorial can renew your ssl certificate:

Wildcard certificates issued by letsencrypt.org need DNS TXT record to challenge, we can add TXT record manually when you apply the cert. If we want to automate it, we need to write a script that use the API of DNS provider to add TXT record. certbot has provided command argument --manual-auth-hook to pass the script.

1. Get a API token

Get your own api token provided by name.com: https://www.name.com/account/settings/api.