Skip to content

Instantly share code, notes, and snippets.

@Configuration
public class FireStoreConfig {
@Bean
public Firestore getFireStore(@Value("${firebase.credential.path}") String credentialPath) throws IOException {
var serviceAccount = new FileInputStream(credentialPath);
var credentials = GoogleCredentials.fromStream(serviceAccount);
var options = FirestoreOptions.newBuilder()
.setCredentials(credentials).build();
from functools import wraps
class Loggable:
def __init__(self, view_class, log_exception=True):
self.view_func = view_class
self.logger = self._get_logger()
def as_view(self, *args, **kwargs):
self.view_func = self.view_func.as_view(*args, **kwargs)
SET global general_log_file='/var/log/mysql/all.log';
SET global log_output = 'file';
SET global general_log = 1;
create database cibling_db;
CREATE USER cblinguser WITH PASSWORD 'cblinguser456789';
ALTER ROLE cblinguser SET client_encoding TO 'utf8';
ALTER ROLE cblinguser SET default_transaction_isolation TO 'read committed';
ALTER ROLE cblinguser SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE cibling_db TO cblinguser;
myproject
├── manage.py
└── myproject
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
myproject
├── manage.py
└── root
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
myseq = ""
for s in SeqIO.parse('file.fasta', 'fasta'):
if s.id == "12345":
myseq = s.seq
break
## model ###
class ModelA(models.model):
field_a =
field_b =
class ModelB(models.model):
model_a = models.Foreignkey(ModelA)
field_C =
## model #####
def OriginRestrictor(get_response):
def middleware(request):
forbid = False
for method in ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']:
if request.method==method and method in method_remote.keys():
allowed_origin = method_remote[method]
request_origin = request.META['REMOTE_ADDR']
if request_origin not in allowed_origin:
forbid=True
column1 column2 column3
I am a sentence 30 category1
I am a bigger sentence 40 category2
thats it 20 category3