def create_map(inp_dict): """ (dict, str) -> (None) Creates a web-map according to the given dict of friends and their locations. """ final_map = folium.Map(zoom_start=5) fg_fr = folium.FeatureGroup(name="Friends locations") tool_tip = "Click me!" colors = [ 'lightred', 'lightgreen', 'black', 'lightgray', 'green', 'darkgreen', 'red', 'cadetblue', 'darkred', 'pink', 'lightblue', 'darkpurple', 'beige', 'purple', 'darkblue', 'gray', 'orange', 'blue' ] styles = ['cloud', 'info-sign'] if inp_dict != {}: for i in inp_dict: try: fg_fr.add_child( folium.Marker(location=inp_dict[i], popup=i, icon=folium.Icon(color=ch(colors), icon=ch(styles)), tooltip=tool_tip)) except ValueError: pass final_map.add_child(fg_fr) final_map.save('mysite/templates/MyMap.html')
def tmn(): kya = input( ch(wrn) + '\n\x1b[0;1m[1]Crack dari list teman\n[2]Crack dari ID teman\n\n[+]Pilih_>' + ch(wrn)) if kya == '1': hz = 'me' elif kya == '2': hz = input(f"{ch(wrn)}\x1b[0;1m[*]id teman: {ch(wrn)}") else: nanya() r = requests.get('https://graph.facebook.com/' + hz + '/friends?limit=999999999&access_token=' + tok) z = json.loads(r.text) for s in z['data']: idf.append(s['id']) print((ch(wrn) + 'Mengambil id: ' + s['id']), end='\r') print('\033[32m[*]\033[32mMengambil id: Done! ') time.sleep(4) print(ch(wrn) + '\033[32m[*]\033[32mTotal:', len(idf)) print('\033[32m[*]\033[32mWaiting..') print("\033[1;97m════════════════════════════════════════") hh = ThreadPool(30) hh.map(crack, idf)
def gen_post_eqn(depth=0): ops = ["+", "-", "*", "/"] if depth >= MAX_EQN_DEPTH: return " " + str(ri(1, 9)) + " " + str(ri(1, 9)) + " " + ch(ops) return gen_post_eqn(depth + 1) + " " + str(ri(1, 9)) + " " + ch(ops) if ri( 0, 1) else " " + str(ri(1, 9)) + gen_post_eqn(depth + 1) + " " + ch(ops)
def competition_data(f, i, n_clubs, n_players, players): reserved = 1 if rf() > 0.8 else 0 club = rr(n_clubs) partecipants = list( filter(lambda j: players[j][6] == club if reserved else True, range(n_players))) return (\ i, f.company(), f.date_between(start_date='-80y'), f.company(), reserved, [([str(rr(1,10)) for k in range(9 if rf() < 0.8 else rr(3,9))],players[j][5],j) for j in sm(partecipants, k=min(len(partecipants),rr(5,21)))], 3, 2, 1, ch((0,3)), ch((0,3)), 0, 5, 6, 11, 12, 18, ch((40, 50, 60)), club)
def rastGelegonder(liste, param): gonderilen = [] for i in range(param): secilen = ch(liste) while secilen in gonderilen: secilen = ch(liste) gonderilen.append(secilen) yield secilen
def gen_in_eqn(depth=0): ops = ["+", "-", "*", "/"] if depth >= MAX_EQN_DEPTH: return "( " + str(ri(1, 9)) + " " + ch(ops) + " " + str(ri(1, 9)) + " )" return "(" + gen_in_eqn(depth + 1) + " " + ch(ops) + " " + str(ri( 1, 9)) + " )" if ri(0, 1) else "( " + str(ri( 1, 9)) + " " + ch(ops) + gen_in_eqn(depth + 1) + " )"
def wel(): for i in 'Welcom To My Toools ': for n in range(20): print((ch(wrn) + ch(stg.ascii_letters + stg.digits + '.') + '\x08'), end='', flush=True) time.sleep(0.001) print(i, end='', flush=True) cls()
def paintEvent(self, event): if self.flag is True: x = ch(0, 500) y = ch(0, 600) l = ch(0, 500) painter = QPainter(self) painter.setPen(QPen(Qt.yellow, 5, Qt.SolidLine)) painter.setBrush(QBrush(Qt.yellow, Qt.SolidPattern)) painter.drawEllipse(x, y, l, l) self.flag = False
def contact(): try: su = int(input(ch(wrn) + '1.WA\n2.Fb\n> ' + ch(wrn))) if su == 1: os.system('xdg-open https://wa.me/62895640466851') elif su == 2: os.system('xdg-open https://fb.me/mayat.mayat.58555') else: nanya() except: pass
def populate(): FacPatient.create_batch(3) FacUnoUser.create_batch(2) for i in range(20): FacObservation.create( owner=ch(UnoUser.objects.all()), patient=ch(Patient.objects.all())) for i in range(20): FacOrdonnance.create( owner=ch(UnoUser.objects.all()), patient=ch(Patient.objects.all())) for i in range(80): FacLigneMedicament.create(ordonnance=ch(Ordonnance.objects.all()))
def generate_name(letters=5, numbers=3): gen = '' letterl = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] numberl = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] for i in xrange(letters): gen += (ch(letterl).upper()) gen += '-' for j in xrange(numbers): gen += (ch(numberl)) return str(gen)
def contact(): try: su = int(input(ch(wrn) + '[?]1.wa> ' + ch(wrn))) if su == 1: os.system('xdg-open https://wa.me/6285710024311') elif su == 2: os.system('') else: nanya() except: pass
def doOne(): while True: digits = '0123456789' a = ch(digits[1:]) b = ''.join([ch(digits) for i in range(98)]) c = ch('1379') p = int(a + b + c) if p % 3 == 0: continue if pow(3, p - 1, p) == 1: break return p
def generate_dialogue(dialogue_tup): gen = '' for entry in dialogue_tup: adjs = () dialogue = ch(entry.keys()) for e in entry[dialogue]: adjs += (ch(e),) # print dialogue # print adjs gen += (dialogue % adjs) return gen
def wel(): for i in 'Loading... ': for n in range(30): print( (ch(wrn) + ch(stg.ascii_letters + stg.digits + '.') + '\x08'), end='', flush=True) time.sleep(0.01) print(i, end='', flush=True) cls() os.system(f"echo -e -n '{ch(wrn)}';cowsay -f vader Selamat datang!")
def func(self, rarity, num): types_of_items = ['Sword', 'Drug', 'Resource'] for count in range(num): type_ = ch(types_of_items) if type_ == 'Resource': num = randint(5, 20) res = ch(items[rarity][type_]) item = [res() for _ in range(1, num)] else: item = ch(items[rarity][type_])() self.items.append(item)
def ReturN(self): _ = 0 for _ in range(10): _ += 1 sys.stdout.write('\r%s[%s*%s]%s Wait A Second ! %s %s ' % (ch(__po__), ch(__po__), ch(__po__), ch(__po__), ch(__po__), str(_))) sys.stdout.flush() time.sleep(self.time) self.DaTez_Kun('\n%s[%s*%s]%s Thanks For Waiting' % (ch(__po__), ch(__po__), ch(__po__), ch(__po__)))
def USERvsUSER(): menu = """ 1-Deadpool 2-IronMan 3-Thanos 4-Thor 5-SpiderMan 6-Hulk Karakteri Seçiniz : """ secim = int(input(menu)) Karlist = [Deadpool, IronMan, Thanos, Thor, SpiderMan, Hulk] P1 = Karlist[secim - 1]() P2 = ch(Karlist)() print(f"P1:{P1.adi} vs P2:{P2.adi}") import time while P1.saglik > 0 and P2.saglik > 0: P2.DefansSec(P1.OfansSec(1)) time.sleep(1) P1.DefansSec(P2.OfansSec(), 1) print( f"P1:{P1.adi} Sağlık:{P1.saglik} vs P2:{P2.adi} Sağlık:{P2.saglik}" ) else: if P1.saglik > P2.saglik: print(P1.adi, "kazandı") elif P1.saglik < P2.saglik: print(P2.adi, "kazandi") else: print("Berabere")
def start_new_game(): global pool global bet #print print('==============================================================') msg = ch(welcome_msg) print msg new_game = raw_input(('Press \'q\' to QUIT (or)\ Any other key to continue:')).lower() if(new_game=='q'): print('==============================================================') print('Aww. Thank you for playing @ oostopitre Casino!') sys.exit() else: print('--> Yay! New Deal:') print('--------------------------------------------------------------') # Clear the player and dealer lists player[:]=[] dealer[:]=[] pool = 0 bet = 0 main()
def takeParametersForTheMapScale_GEO(response): '''получает на вход ответ сервера http://geocode-maps.yandex.ru/1.x/ - response. Возвращает параметры для запроса к http://static-maps.yandex.ru/1.x/ Возвращает словарь, ключами являются: "ll" - точка центра карты, "spn" - градусные замеры карты, "l" - вид карты(карта/спутник/гибридный), "pt" - метки на карте.''' # Преобразуем ответ в json-объект json_response = response.json() # Получаем первый топоним из ответа геокодера. toponym = json_response["response"]["GeoObjectCollection"]["featureMember"][0]["GeoObject"] uCorner = list(map(float, toponym['boundedBy']['Envelope']['upperCorner'].split())) lCorner = list(map(float, toponym['boundedBy']['Envelope']['lowerCorner'].split())) # получамем размеры объекта в градусной мере delta = str(uCorner[0] - lCorner[0]) delta1 = str(uCorner[1] - lCorner[1]) # и забиваем на них delta = '0.008' delta1 = '0.008' # Координаты центра топонима: toponym_coodrinates = toponym["Point"]["pos"] # Долгота и широта: toponym_longitude, toponym_lattitude = toponym_coodrinates.split(" ") # Собираем параметры для запроса к StaticMapsAPI: map_params = { "ll": ",".join([toponym_longitude, toponym_lattitude]), "spn": ",".join([delta, delta1]), "l": "map", 'pt': ",".join([toponym_longitude, toponym_lattitude]) + ',pm2' + ch(['rd', 'gn', 'gr']) + 'l' } if map_params["l"] == 'map': delta = '0.002' delta1 = '0.002' map_params["spn"] = ",".join([delta, delta1]) return map_params
def matthewGraph(d, n): #start with clique c = clique(d) #list of n-d nodes that need to be attached leftover = [x for x in range(d + 1, n + 1)] #get next node in n-d list and add it to dict for node in leftover: #current indegree probabilities current_indegree_prob = {} for key, value in c.items(): current_indegree_prob[key] = 1 for i, j in c.items(): for g in j: if g in current_indegree_prob.keys(): current_indegree_prob[g] += 1 total = sum(current_indegree_prob.values()) for key in current_indegree_prob: current_indegree_prob[key] /= total #take random sample of d nodes with replacement from current nodes in graph, with weights based # on their current indegree distribution: sample_nodes = set( ch(population=list(current_indegree_prob.keys()), weights=list(current_indegree_prob.values()), k=d)) #append set of nodes to list of new node c[node] = list(sample_nodes) return c
def filling_tasks(apps, schema_editor): # We can't import the Person model directly as it may be a newer # version than this migration expects. We use the historical version. Type = apps.get_model('task_tracker_app', "Type") Task = apps.get_model('task_tracker_app', "Task") User = apps.get_model('auth',"User") task_types = Type.objects.all() users = User.objects.all() base_tasks = Task.objects.all() # 1 - created 2 - in progress 3 - done status = 1 for i in range(100000): type = ch(task_types) user = ch(list(users) + [None]) base_task = ch(list(base_tasks) + [None]) if type.name_type == 'дом': rooms = ['кухню', 'ванную', 'комнату', 'гостинную'] actions = ['помыть', 'пропылесосить', 'разобрать'] room = ch(rooms) action = ch(actions) name = '{} {}'.format(action, room) elif type.name_type == 'учёба': courses = ['матан', 'супер ЭВМ', 'базы данных', 'АСОИУ', 'философия'] actions = ['выучить', 'переписать', 'сделать ДЗ'] action = ch(actions) course = ch(courses) name = '{} {}'.format(action, course) elif type.name_type == 'работа': work = ['составить отчёт', 'сделать задание', 'провести планёрку', 'написать заявление'] name = ch(work) elif type.name_type == 'покупки': products = ['молоко', 'хлеб', 'кефир', 'яблоки', 'шоколад', 'капуста', 'сок'] product = ch(products) name = 'купить {}'.format(product) task = Task.objects.create(base_task_id=base_task, name_task=name, type=type, author=user) print(task) task.save()
def new_create(self): self.x = rnd(111, 888) self.y = rnd(111, 444) self.r = rnd(22, 55) self.dx = rnd(-3, 3) self.dy = rnd(-3, 3) self.color = ch(colors) canv.itemconfig(self.ball, fill=self.color)
def DefansSec(self, darbe, param=0): liste = [self.Darbe, self.Savunma] if self.__gizliBirikme == self.__gizli: self.__gizliBirikme = 0 liste.append(self.Yetenek) if param: return self.HareketSecim(liste)(darbe) return ch(liste)(darbe)
def heder(): try: hed = open('agent.txt', 'r').read() if len(hed) < 5 or hed == '': os.remove('agent.txt') exit(ch(wrn) + 'Oops user agent kosong') else: return hed except FileNotFoundError: print(ch(wrn) + 'User agent gak ada!\nKopas dari browser') if os.name == 'nt': os.system('start https://pgl.yoyo.org/http/browser-headers.php') else: os.system('xdg-open https://pgl.yoyo.org/http/browser-headers.php') sw = input(ch(wrn) + 'isi user-agent: ') open('agent.txt', 'w').write(sw) res()
def insult(self): i1 = "you are a " + ch(self.meanNounC) i2 = "you are an " + ch(self.meanNounV) i3 = "go away you " + ch(self.meanAdj) + "-ass " + ch(self.meanNoun) i4 = "you are worse than a " + ch(self.meanNounC) + " " + ch( self.meanAdj) insults = [i1, i2, i3, i4] return ch([insults])
def forecast(series,near): train_near = np.squeeze(near.values[:-30]) train_series = np.squeeze(series.values[:len(train_near)]) test_near = np.squeeze(near.values[-30:]) test_series = np.squeeze(series.values[-30:]) df = pd.DataFrame(columns=['aic','nonSeasonal','seasonal','k']) for i in range(25): print('value of i is:',i) nonSeasonalParams = ch(nonSeasonal) seasonalParams = ch(seasonal) val = sum(list(nonSeasonalParams)) + sum(list(seasonalParams)) #try: if(val>8): continue seasonalParams = seasonalParams + (7,) #print(nonSeasonalParams,seasonalParams) try: trans = FourierFeaturizer(365.25, 1) y_prime, exogen = trans.fit_transform(train_series) #exogen = exogen.mul(pd.Series(train_series),axis=0) exogen['near'] = train_near model = sm.tsa.statespace.SARIMAX(endog = train_series, exog = train_near, order = nonSeasonalParams, seasonal_order = seasonalParams,initialization='approximate_diffuse',enforce_stationarity=False) res = model.fit(disp=False) #print(res.aic) to_append = [res.aic,nonSeasonalParams,seasonalParams,1] a_series = pd.Series(to_append, index = df.columns) df = df.append(a_series, ignore_index=True) except: print('inside except block now.....') x = pd.Series([10000000,(1,1,1),(1,1,1),1],index = df.columns) df = df.append(x, ignore_index=True) x = pd.Series([10000000,(1,1,1),(1,1,1),1],index = df.columns) df = df.append(x, ignore_index=True) print('df is :',df) dx = (df[df.aic == df.aic.min()]) dx.reset_index(inplace=True,drop=True) print('baest parameters are:',dx) value = [dx.iloc[0][0],dx.iloc[0][1],dx.iloc[0][2],dx.iloc[0][3]] print('final parameters are:',value) return value
def mess_it_up(txt): lis = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;?@[\\]^_`{|}~ \t\n\r\x0b\x0c' l = len(txt) mod_txt = '' for i in range(l): if txt[i] != ' ': c = ch(lis) mod_txt = mod_txt + c else: mod_txt = mod_txt + ' ' return mod_txt
def __init__(self): self.x = rnd(111, 888) self.y = rnd(111, 444) self.r = rnd(22, 55) self.dx = rnd(-3, 3) self.dy = rnd(-3, 3) self.ball = canv.create_oval(self.x - self.r, self.y - self.r, self.x + self.r, self.y + self.r) self.color = ch(colors) canv.itemconfig(self.ball, fill="#610B4B") canv.addtag_withtag("ball", self.ball)
def Seva_bot(history,index,table): from random import choice as ch if index == 0: ei = 1 else: ei = 0 if len(history) == 0: return ch([True,False]) eh = [history[i][ei] for i in range(len(history))] me = sum(eh)/len(eh) return me>0.5
def PCvsPC(): Karlist = [Deadpool, IronMan, Thanos, Thor, SpiderMan, Hulk] P1 = ch(Karlist)() P2 = ch(Karlist)() print(f"P1:{P1.adi} vs P2:{P2.adi}") import time while P1.saglik > 0 and P2.saglik > 0: P2.DefansSec(P1.OfansSec()) time.sleep(1) P1.DefansSec(P2.OfansSec()) print( f"P1:{P1.adi} Sağlık:{P1.saglik} vs P2:{P2.adi} Sağlık:{P2.saglik}" ) else: if P1.saglik > P2.saglik: print(P1.adi, "kazandı") elif P1.saglik < P2.saglik: print(P2.adi, "kazandi") else: print("Berabere")
def tmn(): kya = input(ch(wrn) + '\n\x1b[0;1m1). From friend list\n2). From People ID\n\n +>>>' + ch(wrn)) if kya == '1': hz = 'me' elif kya == '2': hz = input(f"{ch(wrn)}\x1b[0;1m[+] ID Friend : {ch(wrn)}") else: nanya() r = requests.get('https://graph.facebook.com/' + hz + '/friends?limit=999999999&access_token=' + tok) z = json.loads(r.text) for s in z['data']: idf.append(s['id']) print((ch(wrn) + 'Mengambil id: ' + s['id']), end='\r') print('\033[1;97m[+] Mengambil id: Done! ') time.sleep(4) print(ch(wrn) + '\033[1;97m[+] Total:', len(idf)) print("\033[1;97m[+] Cracking ...") print("\033[1;91m----------------------------") hh = ThreadPool(30) hh.map(crack, idf)
def start_track(self, user_name, task): """method that creates tracker""" self.tracker_name = input("name your tracker: ") if self.tracker_name == whitespace: choices = ascii_letters self.tracker_name = ch(choices).strip(str=4) return self.tracker_name else: pass self.task = task self.tracker_describe = input("describe your tracker: ") return self
def simulate(): bulb=OFF knowledge = collections.defaultdict(set) seen = set() hits = 0 for day in itertools.count(1): pris = ch(PRISS) seen.add(pris) knowledge[pris].add(pris) if bulb == ON: prisoners_received = dtp(day) knowledge[pris] |= prisoners_received if len(knowledge[pris]) == n: action = DECL else: next_day_prisoners = dtp(day+1) if all((p in knowledge[pris]) for p in next_day_prisoners): action = ON else: action = OFF if action == ON: hits += 1 if day % 10000 == 0: av_knowledge = sum(len(v) for k,v in knowledge.iteritems()) / float(len(knowledge)) print day, av_knowledge, hits * 100. / 10000. hits = 0 if action == ON: bulb = ON elif action == OFF: bulb = OFF elif action == DECL: if len(seen) == n: return day else: return -1
def list_room_contents(self, room): object_dic = None for e in self.rooms_desc: if e.lower() == room.lower(): object_dic = self.rooms_objs[e] for obj in object_dic: cprint('\t' + obj) obj_control = { # reflect on past ??? "Captain's seat": 'Located inside a cramped hallway lined with toggles, switches, and holographic displays, ' 'the pilot would have spent most of his time here directing crewmen elsewhere in the ship. ' '%s ' % (ch(adj_strange)), "Small window": "The windows in the cabin were kept small to prevent structural failures in the most populated " "area of the vessel. There is very little to look at. ", "Your ship": "You peer through the small window and spot your own ship. It is alien in form, a vaguely spherical " "object floating alone through unpopulated space. It was originally a satellite designed to travel " "%s distances by accelerating ions to %s speeds. In %s it was re-purposed as an " "exploratory vessel to be sold for consumer use. You feel embarrassed. " % (ch(adj_large), ch(adj_pos), ch(random_number)), "Overhead display": "A masterwork of machine-weaving and light, the overhead display is formed of a network of " "ultra-light fibers woven into a fine mesh. The fibers are dynamically " "lit by a neighboring computer to project %s three dimensional images to the crew. " "It is protected by a thick sheet of glass. " % (ch(adj_pos)), } obj_observ = {
#!/usr/bin/python # An obfuscated python implementation in a single line to demonstrate the # flexibility of functional python as well as several interesting abuses # of language features from random import random as r, choice as ch from sys import stdout as so target = 'methinks it is like a weasel' alpha = 'abcdefghijklmnopqrstuvwxyz ' rate = 0.04 generation_size = 100 for i in enumerate(iter(lambda:[ch(alpha) for i in range(len(target))] if 'gs' not in globals() else None if globals().get('l',False) else max(map(lambda c:(c,sum(x==y for x,y in zip(c,target))), [map(lambda d:ch(alpha) if r()<rate else d,gs) for i in range(generation_size)]), key=lambda x:x[1])[0],None)): gs, globals()['l'], t = i[1], globals().get('gs') == list( target), so.write('%d %s\n' % (i[0] + 1, ''.join(i[1])))
def draw(member): pick = ch(cards.keys()) member.append(pick)
#!/usr/bin/python # An obfuscated python implementation in a single line to demonstrate the # flexibility of functional python as well as several interesting abuses # of language features from random import random as r, choice as ch from sys import stdout as so target = 'methinks it is like a weasel' alpha = 'abcdefghijklmnopqrstuvwxyz ' rate = 0.04 generation_size = 100 for i in enumerate(iter(lambda:[ch(alpha) for i in range(len(target))] if 'gs' not in globals() else None if globals().get('l',False) else max(map(lambda c:(c,sum(x==y for x,y in zip(c,target))), [map(lambda d:ch(alpha) if r()<rate else d,gs) for i in range(generation_size)]), key=lambda x:x[1])[0],None)): gs,globals()['l'],t=i[1],globals().get('gs')==list(target),so.write('%d %s\n'%(i[0]+1,''.join(i[1])))
def select_rooms(self): return ch(wreckage_rooms)
def generate_name_astral_body(name_list): gen = '' gen += ch(name_list).upper() + generate_name(letters=0, numbers=4) return gen
def random_dialogue(l): return ch(l)