This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from typing import Dict, List, Any | |
def hash_outer_join_two_tuple(list1, list2, list1_fields, list2_fields): | |
dict1 = defaultdict(list) | |
dict2 = defaultdict(list) | |
def pk(r, fields): | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shell script to add docker-ce to Deepin Linux repositories | |
# Remove old docker | |
sudo apt-get remove -y docker docker-engine docker.io containerd runc | |
# Install dependencies | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_to_dikt(s): | |
dikt = {} | |
for word in s: | |
if dikt.get(word): | |
dikt[word] = dikt[word] + 1 | |
else: | |
dikt[word] = 1 | |
print(dikt) | |
return dikt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Router: | |
def __new__(cls, origin, destination): | |
return ['post_office1', 'post_office2', 'post_office3', 'post_office4'] | |
class Package: | |
def __init__(self, route): | |
self.route = route | |
self.trip = self.generate_trip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"ICECREAM" | |
from sqlalchemy import Column, Integer, String, ForeignKey, Boolean, Numeric, Table, Date | |
from sqlalchemy.orm import relationship, backref | |
from ICECREAM.db_initializer import Base | |
######### simple table tutorial ############# | |
class Product(Base): | |
__tablename__ = 'product' | |
id = Column(Integer, primary_key=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to create a backup | |
docker exec -t <container-id> pg_dumpall -c -U postgres_user > backup.sql | |
to restore it : | |
cat backup.sql | docker exec -i postgres psql -U postgres_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |