Skip to content

Instantly share code, notes, and snippets.

@kohigh
kohigh / memorySizeOfObject.js
Created February 8, 2022 09:55
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@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.

@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 / gist:746273eb69a8b308f21336346f541637
Created March 19, 2019 14:01
Ruby's performance tuning way
@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 / 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 / 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_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 / 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