Skip to content

Instantly share code, notes, and snippets.

View muhammad-ammar's full-sized avatar

Muhammad Ammar muhammad-ammar

View GitHub Profile
+ aws_instance.veda_sandbox
ami: "ami-2e5e9c43"
associate_public_ip_address: "<computed>"
availability_zone: "<computed>"
ebs_block_device.#: "<computed>"
ephemeral_block_device.#: "<computed>"
instance_state: "<computed>"
instance_type: "g2.2xlarge"
ipv6_address_count: "<computed>"
ipv6_addresses.#: "<computed>"
@muhammad-ammar
muhammad-ammar / terraform-apply.txt
Last active July 4, 2017 07:11
terraform apply error
~/Documents/edx/terraform apply
aws_s3_bucket.store_bucket: Creating...
acceleration_status: "" => "<computed>"
acl: "" => "private"
arn: "" => "<computed>"
bucket: "" => "videoimage-vedastore"
bucket_domain_name: "" => "<computed>"
force_destroy: "" => "false"
hosted_zone_id: "" => "<computed>"
region: "" => "<computed>"
@muhammad-ammar
muhammad-ammar / terraform-apply-issues.txt
Created July 14, 2017 14:17
veda sandbox setup issues
Error applying plan:
4 error(s) occurred:
* aws_security_group.veda_sec_sandbox: 1 error(s) occurred:
* aws_security_group.veda_sec_sandbox: Error creating Security Group: UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: 0ba702bc-7931-4f84-a9ce-7b066d583792
* aws_s3_bucket.store_bucket: 1 error(s) occurred:

When you modify a file in your repository, the change is initially unstaged. In order to commit it, you must stage it—that is, add it to the index—using git add. When you make a commit, the changes that are committed are those that have been added to the index.

git reset changes, at minimum, where your current branch is pointing. The difference between --mixed and --soft is whether or not your index is also modified. So, if we're on branch master with this series of commits:

- A - B - C (master)

HEADpoints to C and the index matches C.

--soft

@muhammad-ammar
muhammad-ammar / sandbox_auth.md
Created June 20, 2019 15:56
sandbox auth issues

Error on LMS

Jun 20 15:51:18 mammar [service_variant=lms][openedx.core.djangoapps.user_authn.views.login_form][env:sandbox] ERROR [mammar  30471] [user None] [login_form.py:90] - Unknown tpa_hint provider: 'tpa_hint'
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_authn/views/login_form.py", line 74, in login_and_registration_form
    provider_id = next_args['tpa_hint'][0]
KeyError: 'tpa_hint'
@muhammad-ammar
muhammad-ammar / __init__.py
Created March 4, 2020 22:18 — forked from aubricus/__init__.py
Using Fabric to connect to the remote server via an ssh config.
from fabric.api import env
env.use_ssh_config = True
env.forward_agent = True
env.roledefs = {
# key # hostname from config
'foo': ['foo.production'],
}
@muhammad-ammar
muhammad-ammar / log_db_queries.py
Created June 1, 2020 09:03 — forked from bak1an/log_db_queries.py
django decorator for logging db queries
# simple decorator for logging out django db queries
# just put it along with other decorators before view or
# db-loading stuff. than go to your console and see whats going on.
# example:
#
# @log_db_queries
# @login_required
# def your_view(request, args...):
# your stuff
def log_db_queries(f):
@muhammad-ammar
muhammad-ammar / surveymonkey_api_client.py
Created February 9, 2023 22:20
SurveyMonkey API V3 Client
# -*- coding: utf-8 -*-
"""
SurveyMonkey API Client.
"""
import os
import logging
from functools import wraps
from urllib.parse import urlencode, urljoin
import requests
@muhammad-ammar
muhammad-ammar / importer.py
Created February 9, 2023 22:30
Importer script to survery responses from SurveyMonkey
"""
Script to import survey data from SurveyMonkey.
"""
import json
import logging
from client import SurveyMonkeyApiClient, SurveyMonkeyDailyRateLimitConsumed
LOGGER = logging.getLogger(__name__)
>> python survey_importer/importer.py
02-10 02:23 __main__ INFO Fetching survey data. SurveyID: [576851080], LastSuccessfullExportTimestamp: [None], URL: [https://api.surveymonkey.com/v3/surveys/576851080/responses/bulk?simple=True&sort_order=ASC&per_page=100]
02-10 02:23 __main__ INFO {
"survey_id": 576851080,
"survey_response_id": 118240634082,
"Your favorite programming language?": [
"Python",
"Rust"
],