Skip to content

Instantly share code, notes, and snippets.

View nandak522's full-sized avatar
💭
Busy in that 1% learning!

Nanda Kishore nandak522

💭
Busy in that 1% learning!
View GitHub Profile
def login_using_email(request, email):
'''DONT EVER USE this method for normal purposes. This is only there, for debugging specific problems related to users'''
from django.contrib.auth import get_backends
backend = get_backends()[0]
from django.contrib.auth.models import User
user = User.objects.get(email=email)
user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)
from django.contrib.auth import login as django_login
django_login(request, user)
#set_any_extra_session_variables(request)
from django.core.management.base import BaseCommand
class Command(BaseCommand):
option_list = BaseCommand.option_list
help = "Scans through the given app for faulty imports, or the entire project directory if no apps are specified"
args = '[appname ...]'
requires_model_validation = False
def import_statement_extractor(self, directory_path, python_file):
python_file = '%s/%s' % (directory_path, python_file)
from django.db import models
from utils.models import BaseModel
class ActiveQuestionManager(models.Manager):
def get_query_set(self):
return super(ActiveQuestionManager, self).get_query_set().filter(is_active=True)
class PublicQuestionManager(models.Manager):
def get_query_set(self):
return super(PublicQuestionManager, self).get_query_set().filter(visible=True)
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set incsearch nohlsearch
noremap <F4> :set hls!<CR>
PS1="[\u@\h \w]\\$ "
alias grep='grep -s --color'
alias ls='ls --color'
alias vi='vim'
export COLUMNS=150
cd <your_workspace_path>
package example.grpc.clients.testing_service;
import java.util.concurrent.TimeUnit;
import io.grpc.ManagedChannel;
import io.grpc.Metadata;
import io.grpc.java.testing_service.TestingGrpc;
import io.grpc.java.testing_service.TestingGrpc.TestingBlockingStub;
import io.grpc.java.testing_service.TestingRequest;
import io.grpc.java.testing_service.TestingResponse;
package example.grpc.clients.testing_service.jmeter;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.apache.jmeter.samplers.SampleResult;
import example.grpc.clients.testing_service.TestingServiceClient;
import io.grpc.StatusRuntimeException;
package example.grpc.clients.testing_service;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.ForwardingClientCall.SimpleForwardingClientCall;
import io.grpc.ForwardingClientCallListener.SimpleForwardingClientCallListener;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.java.testing_service";
option java_outer_classname = "TestingServiceProto";
option objc_class_prefix = "HLW";
package testing_service;
service Testing {
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${protobuf-maven-plugin.version}</version>
<configuration>
<protocArtifact>
com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>