Skip to content

Instantly share code, notes, and snippets.

View atwalsh's full-sized avatar

Adam Walsh atwalsh

View GitHub Profile
@TakahikoKawasaki
TakahikoKawasaki / sinatra+ssl.rb
Created December 16, 2014 14:44
Sinatra + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra.
#
require 'sinatra/base'
class Application < Sinatra::Base
configure do
set :bind, '0.0.0.0'
@magnetikonline
magnetikonline / README.md
Last active June 7, 2023 20:57
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
@oleksiiBobko
oleksiiBobko / tcp_server.c
Last active November 4, 2024 15:47
Simple socket server in C using threads (pthread library) Compiles on linux
/*
C socket server example, handles multiple clients using threads
Compile
gcc server.c -lpthread -o server
*/
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
@MikeRatcliffe
MikeRatcliffe / FreeNAS.md
Last active December 2, 2021 23:26 — forked from jacobblock/FreeNAS.md
Ultimate FreeNAS Setup
@tyliec
tyliec / Terraria.md
Last active August 11, 2020 13:52
Terraria Server Setup Guide

This is a Terraria Server Setup Guide for Digital Ocean

This guide might not do everything the right way, but it works.

No bullshit. Straight up what I did to get it working. (Ubuntu 16.04 64bit)

ssh into your droplet

Update your shit

@TonyFrancis
TonyFrancis / MultiTenantFlask.py
Created May 18, 2017 04:48
Creating multi Tenant system with multiple Database. Switching between databases based on subdomain related to tenant
from functools import wraps
from flask import Flask, g, session, request, abort, jsonify
from flask_migrate import MigrateCommand, Migrate
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
flask_app = Flask(__name__, static_folder='./static')
db = SQLAlchemy()
migrate = Migrate()
@xadapter
xadapter / functions.php
Last active March 8, 2018 17:05
Hide striked out price on Product and Shop pages with Xadapter WooCommerce Dynamic Pricing and Discounts plugin
add_filter('woocommerce_get_price_html', "xa_only_sale_price", 99, 2);
function xa_only_sale_price($price, $product)
{
if(!is_cart() && !is_checkout() && !is_ajax()){
if ($product->is_type('simple') || $product->is_type('variation')) {
return regularPriceHTML_for_simple_and_variation_product($price, $product);
}
}
return $price;
@EdMan1022
EdMan1022 / config.py
Created August 29, 2018 15:52
Flask config setup that utilizes a Singleton pattern to always return the same configuration instance when called multiple times. Could allow for other functions or methods to run and modify the config, and have those changes represented later on during app lifetime.
from os import environ
from logging.config import dictConfig
from werkzeug.security import generate_password_hash
class BaseConfig(object):
def _config_logger(self):
"""