Skip to content

Instantly share code, notes, and snippets.

Saikiran Yerram Syerram

Block or report user

Report or block Syerram

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
@Syerram
Syerram / gist:7002597
Last active Dec 25, 2015
Setup for Django Presentation
View gist:7002597

Setup

Pre-requisites

  • Python 2.6 or higher - Higher version is better but 2.6 will do. You're on your own with Python 3.xx version.
    • For Windows users, see the last section
  • pip:
    • Most *nix distributions come with easy_install. To check if its installed, do which easy_install. It should list the path to the file.
    • If the above works, then run this at command line easy_install pip. [might require you to install as admin]
  • django: At command line run pip install django==1.4
    • To install it manually, especially for Windows users, see the last section.
@Syerram
Syerram / gist:7045629
Last active Dec 25, 2015
Django Code workshop
View gist:7045629

Coding

Startup

#creates a new folder.
$ django-admin.py startproject my_todo

$ cd my_todo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style type="text/css">
a { display:block; margin: 10px 0;}
</style>
</head>
<body>
View N-Queens - Incomplete
#Snapshot of exact code at the end of the test.
#I wanted to first find all solutions to place N queen such no two queens threaten each other
#From that, I can then find a max threat
#Hardcoding due to insufficient time
N = 4
#{3,1,4, 1}
board = [
[0, 0, 1, 0],
@Syerram
Syerram / cf-dot-get-mem.sh
Last active Jun 26, 2019
cf dot - Get free memory after the CF upgrade
View cf-dot-get-mem.sh
# For help on this command, please contact the Diego team on CF slack channel #diego
cfdot cell-states \
| jq '(.RootFSProviders.preloaded.set | keys) as $rootfses | select($rootfses | contains(["linux"])) | .segment = "Segment: \(.PlacementTags | .[0] // "(shared)") | Stacks: \($rootfses | join(", "))"' \
| jq '{segment, containers: (.TotalResources.Containers - .AvailableResources.Containers), total_memory: .TotalResources.MemoryMB, free_memory: .AvailableResources.MemoryMB, cells: 1}' \
| jq -s 'reduce (.[] | .segment as $s | del(.segment) | to_entries[] | .segment = $s) as $i ({}; .[$i.segment][$i.key] += $i.value) | to_entries | map(.value.segment = .key | .value) | sort_by(.segment) | .[]' \
| jq -r '(.free_memory - (.containers * 32)) as $free_memory_after | "\(.segment)\n Cells: \(.cells)\n Containers: \(.containers)\n Current Free Memory: \(.free_memory) MB / \(.free_memory / .total_memory * 1000 | floor /10)%\n Additional Memory Required: \(.containers * 32) MB\n Free Memory Afterward: \($free_memo
View test-failure-option-a.log
• Failure [253.063 seconds]
[route_services]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:108
Route Services
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:114
when a route binds to a service
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:25
when service broker returns a route service url
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:26
a request to the app is routed through the route service [It]
View test-failure-option-b.log
• Failure [253.063 seconds]
[route_services]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:108
Route Services
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:114
when a route binds to a service
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:25
when service broker returns a route service url
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:26
a request to the app is routed through the route service [It]
View test-failure-option-c.log
• Failure [253.063 seconds]
[route_services]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:108
Route Services
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:114
when a route binds to a service
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:25
when service broker returns a route service url
/go/src/github.com/cloudfoundry/cf-acceptance-tests/route_services/route_services.go:26
a request to the app is routed through the route service [It]
View setup-failure-option-a.log
• Failure in Spec Setup (BeforeEach) [85.028 seconds]
[routing]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:164
Zipkin Tracing
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:174
when zipkin tracing is enabled [BeforeEach]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/routing/zipkin_tracing.go:44
when zipkin headers are not in the request
/go/src/github.com/cloudfoundry/cf-acceptance-tests/routing/zipkin_tracing.go:45
the sleuth error response has no error
View setup-failure-option-b.log
• Failure in Spec Setup (BeforeEach) [85.028 seconds]
[routing]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:164
Zipkin Tracing
/go/src/github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers/cats_suite_helpers.go:174
when zipkin tracing is enabled [BeforeEach]
/go/src/github.com/cloudfoundry/cf-acceptance-tests/routing/zipkin_tracing.go:44
when zipkin headers are not in the request
/go/src/github.com/cloudfoundry/cf-acceptance-tests/routing/zipkin_tracing.go:45
the sleuth error response has no error
You can’t perform that action at this time.