Skip to content

Instantly share code, notes, and snippets.

View mmuoDev's full-sized avatar

obioha uche mmuoDev

  • Berlin
View GitHub Profile
@tmaiaroto
tmaiaroto / usc.go
Created November 7, 2014 20:25
Golang map of US state codes : full name
// A handy map of US state codes to full names
var usc = map[string]string{
"AL": "Alabama",
"AK": "Alaska",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
@SaeedPrez
SaeedPrez / LoginController.php
Created March 12, 2017 16:42
Laravel 5.4 Additional Login Conditions - Add custom error message.
<?php
// This is code to return custom error message
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk
namespace App\Http\Controllers\Auth;
@james2doyle
james2doyle / getXML.go
Last active July 28, 2024 06:00
Use HTTP to GET and parse XML in golang
// tweaked from: https://stackoverflow.com/a/42718113/1170664
func getXML(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
return []byte{}, fmt.Errorf("GET error: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return []byte{}, fmt.Errorf("Status error: %v", resp.StatusCode)
@oseiskar
oseiskar / swagger-yaml-to-html.py
Last active April 30, 2024 10:57
Converts Swagger YAML to a static HTML document (needs: pip install PyYAML)
#!/usr/bin/python
#
# Copyright 2017 Otto Seiskari
# Licensed under the Apache License, Version 2.0.
# See http://www.apache.org/licenses/LICENSE-2.0 for the full text.
#
# This file is based on
# https://github.com/swagger-api/swagger-ui/blob/4f1772f6544699bc748299bd65f7ae2112777abc/dist/index.html
# (Copyright 2017 SmartBear Software, Licensed under Apache 2.0)
#
@chumaumenze
chumaumenze / gunicorn_config.py
Last active May 21, 2020 15:34
Basic Gunicorn/Supervisor/Nginx config for deploying Python apps.
import multiprocessing
bind = '0.0.0.0:8000'
workers = multiprocessing.cpu_count()
worker_class = 'gevent'
accesslog = '/var/log/progam_name/gunicorn/access.log'
errorlog = '/var/log/progam_name/gunicorn/error.log'
loglevel = 'debug'
access_log_format = '[%(h)15s] (%(s)s) [%(D)8sms] %(r)s | %(b)sb'
proc_name = 'progam_name_gunicorn'
package main
import (
"sync/atomic"
"time"
)
var sharedIntForAtomic int64 = 0
var unusedValueForAtomic int = 0