Skip to content

Instantly share code, notes, and snippets.

Adam B. liladas

Block or report user

Report or block liladas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@liladas
liladas / swagger-yaml-to-html.py
Created Jun 27, 2019 — forked from oseiskar/swagger-yaml-to-html.py
Converts Swagger YAML to a static HTML document (needs: pip install PyYAML)
View swagger-yaml-to-html.py
#!/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)
#
@liladas
liladas / dst.sh
Created Mar 27, 2019
Check Daylight Savings
View dst.sh
#!/bin/bash
PST_TIME=$(env TZ=America/Los_Angeles date +"%-H")
UTC_TIME=$(env TZ=UTC date +"%-H")
DST_CHECK=$(($PST_TIME + 8 - $UTC_TIME))
echo "PST Hour:" $PST_TIME
echo "UTC Hour:" $UTC_TIME
@liladas
liladas / FizzBuzzGenerator.py
Last active Aug 9, 2018
"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
View FizzBuzzGenerator.py
# FizzBuzz in Python w/ Generators
# http://c2.com/cgi/wiki?FizzBuzzTest
# -- inspired by @dabeaz
def fizzbuzz(max_num=101):
for i in range(max_num):
value = ""
if i % 3 == 0: value += "Fizz"
if i % 5 == 0: value += "Buzz"
yield value if value else i
@liladas
liladas / gource.sh
Created Jun 8, 2018 — forked from qiaoxueshi/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
View gource.sh
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@liladas
liladas / DST_check.sh
Created May 30, 2018
Check DST for cronjobs
View DST_check.sh
#!/bin/bash
PST_TIME=$(env TZ=America/Los_Angeles date +"%-H")
UTC_TIME=$(env TZ=UTC date +"%-H")
DST_CHECK=$(($PST_TIME + 8 - $UTC_TIME))
echo "PST Hour:" $PST_TIME
echo "UTC Hour:" $UTC_TIME
@liladas
liladas / checker.py
Created May 6, 2018
Assertion Check
View checker.py
#!/usr/bin/env python3
import sys, logging
class FailedValidationException(Exception):
pass
class ClassToValidate(object):
def assert__testing_external(self):
return True
@liladas
liladas / past_time_window.py
Created Apr 30, 2018
Getting previous time windows
View past_time_window.py
#!/usr/bin/env python3
from datetime import datetime, timedelta
current_time = datetime.now()
start_time = current_time.replace(microsecond=0,second=0,minute=0,hour=0)-timedelta(days=1)
end_time = current_time.replace(microsecond=0,second=0,minute=0,hour=0)-timedelta(seconds=1)
print("Getting All Data from Day Prior")
print("Time of invocation:", current_time)
print("Start Time Window :", start_time)
@liladas
liladas / systemd.sh
Last active Apr 12, 2018
Helper script for installing/uninstalling systemd service files
View systemd.sh
#!/bin/bash
CMD="$(basename $0)"
usage() {
echo "usage: $CMD [-f file | -n name ] [ -i | -u | -s | -r ] [-v] | [-h]"
echo ''
echo 'systemd service installer'
echo 'optional arguments:
-h, --help show this help message and exit
@liladas
liladas / print_logger.py
Last active Apr 5, 2018
Mock logger object with auto function and label generation
View print_logger.py
class Singleton(object):
''' singleton class only allows for one instantiation per python interpreter '''
_instance = None
def __new__(class_, *args, **kwargs):
''' override __new__ behavior to only return new instance if not previously instantiated '''
if not isinstance(class_._instance, class_):
class_._instance = object.__new__(class_, *args, **kwargs)
return class_._instance
class PrintLogger(Singleton):
@liladas
liladas / github.css
Created Feb 23, 2018 — forked from andyferra/github.css
Github Markdown CSS - for Markdown Editor Preview
View github.css
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
You can’t perform that action at this time.