Skip to content

Instantly share code, notes, and snippets.

⌨️
God is a coder

Roy Segall RoySegall

⌨️
God is a coder
Block or report user

Report or block RoySegall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2bfaf344853442970d31e910ceefadf5
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.033 0.033 9.693 9.693 C:\Users\roy.DM\Projects\dms\dreamed_dms\parsers\tidepool_parser.py:36(parse)
7114/5068 0.028 0.000 7.011 0.001 C:\Users\roy.DM\Envs\dms\lib\site-packages\django\db\models\manager.py:81(manager_method)
2355 0.023 0.000 5.815 0.002 C:\Users\roy.DM\Envs\dms\lib\site-packages\django\db\models\query.py:528(get_or_create)
1048 0.014 0.000 4.264 0.004 C:\Users\roy.DM\Projects\dms\dreamed_dms\parsers\tidepool_parser.py:629(parse_boluses)
1 0.001 0.001 4.129 4.129 C:\Users\roy.DM\Projects\dms\dreamed_dms\tests\base_test_utils.py:227(generate_input_json)
1 0.234 0.234 4.128 4.128 C:\Users\roy.DM\Projects\dms\adp_api\core\lib.py:138(__init__)
5107 0.036 0.000 4.040 0.001 C:\Users\roy.DM\Envs\dms\lib\site-packages\django\db\models\sql\compiler.py:1072(execute_sql)
4255 0.052 0.000 3.600 0.
View imdb_endgame_scrape.py
from selenium import webdriver
driver = webdriver.Firefox()
# This the address for Avengers: Endgame.
driver.get("https://www.imdb.com/title/tt4154796/")
# Starting to scrape after the first tr. The first tr holds a label which not relevant in any way.
cast_rows = driver.find_elements_by_xpath("//table[@class='cast_list']//tr[position()>1]")
View dummy-section.html
<div class='header' id='header'>
<p>First paragraph</p>
<ul class='items' id='items'>
<li class='first'>First item</li>
<li>Second item</li>
<li class='last'>Last item</li>
</ul>
<img class='img-responsive profile-picture' src='http://....' />
</div>
View duplicates.py
for sheet_name in mapping:
sheet_keys = {}
for sheet_key in mapping[sheet_name]:
translated = mapping[sheet_name][sheet_key]
if translated in sheet_keys:
print(f"{translated} exists in column {sheet_keys[translated]} and {sheet_key} under sheet {sheet_name}")
sheet_keys[translated] = sheet_key
View service_conteinter.py
import inspect
from abc import abstractmethod
class BaseService:
@abstractmethod
def info(self):
return 'this is the base service'
View gmail_messages.json
[{"id": "16c057fea8f53620", "threadId": "16c057feaa55a17a", "labelIds": ["UNREAD", "IMPORTANT", "SENT", "INBOX"], "snippet": "Did not open this one yet", "historyId": "1493258", "internalDate": "1563460354000", "payload": {"partId": "", "mimeType": "multipart/alternative", "filename": "", "headers": [{"name": "MIME-Version", "value": "1.0"}, {"name": "Date", "value": "Thu, 18 Jul 2019 17:32:34 +0300"}, {"name": "Message-ID", "value": "<CACq5172xEcosR8w1CbbXa7H05S03mVyHci8f+=Lx0PvJvsLnSg@mail.gmail.com>"}, {"name": "Subject", "value": "This message not read"}, {"name": "From", "value": "Roy Segall <roy@segall.io>"}, {"name": "To", "value": "Roy Segall <roy@segall.io>"}, {"name": "Content-Type", "value": "multipart/alternative; boundary=\"000000000000b0a0f7058df57b2c\""}], "body": {"size": 0}, "parts": [{"partId": "0", "mimeType": "text/plain", "filename": "", "headers": [{"name": "Content-Type", "value": "text/plain; charset=\"UTF-8\""}], "body": {"size": 27, "data": "RGlkIG5vdCBvcGVuIHRoaXMgb25lIHlldA0K"}}, {
View failed.json
[{'file': 'foo', 'error': 'bar'}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/source_files/השלמות/512065202_g948_0118.xlsx', 'error': TypeError("error() missing 1 required positional argument: 'msg'",)}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/source_files/השלמות/רשימת-נכסים-2015-Q3 (2).xlsx', 'error': TypeError("error() missing 1 required positional argument: 'msg'",)}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/source_files/השלמות/reshimat_nechasim_tagmulim_Q2_2015.xlsx', 'error': TypeError("error() missing 1 required positional argument: 'msg'",)}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/source_files/השלמות/11373 (4)(1).xls', 'error': TypeError("error() missing 1 required positional argument: 'msg'",)}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/source_files/השלמות/9639 (2) (1).xls', 'error': TypeError("error() missing 1 required positional argument: 'msg'",)}, {'file': '/Applications/MAMP/htdocs/open_pension/processor/sou
View LandingPage.vue
<template>
<div id="wrapper">
<main>
<b>Welcome!</b>
<ul>
<li v-for="file in files">{{file}}</li>
</ul>
</main>
</div>
View index-ready-event.js
function createWindow () {
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
webPreferences: {
nodeIntegration: true,
View index-open-file-section.js
import fs from 'fs';
const files = [];
app.on('open-file', (event, path) => {
files.push(path);
});
You can’t perform that action at this time.