Skip to content

Instantly share code, notes, and snippets.

☕️
kickin' it

Dmitry Brant dbrant

☕️
kickin' it
Block or report user

Report or block dbrant

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
@dbrant
dbrant / uploadfiles.py
Created Jan 8, 2020
Upload a list of files to Google Drive
View uploadfiles.py
import os
import sys
import pickle
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
directoryIndexMap = {}
@dbrant
dbrant / sendemail.py
Created Jan 8, 2020
Send email via python
View sendemail.py
import smtplib
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login("account@example.com", password)
msg = "To: destination@example.com\n"
msg += "From: source@example.com\n"
msg += "Subject: "
@dbrant
dbrant / arcDestruct.bat
Last active May 22, 2019
Windows Batch file for auto-extracting ARC archives into their own directory.
View arcDestruct.bat
REM You can put this batch file on your Desktop, and drag-and-drop ARC files into it!
REM It will automatically create a folder with the same name as the ARC file, extract the files into it, and delete the original ARC file.
mkdir "%~p1\%~n1"
move %1 "%~p1\%~n1"
cd "%~p1\%~n1"
E:\cygwin\bin\arc.exe x "%~p1\%~n1\%~n1.arc"
del "%~p1\%~n1\%~n1.arc"
View gist:4f4fd6b9e5f1a521a902092bb3c24e7a
{
"batchcomplete": "",
"query": {
"notifications": {
"list": [
{
"wiki": "enwiki",
"id": "73770596",
"type": "edit-user-talk",
"category": "edit-user-talk",
@dbrant
dbrant / pi_gpio_sample.py
Created Mar 19, 2016
GPIO sample for Raspberry Pi
View pi_gpio_sample.py
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(4,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(25,GPIO.OUT)
index = 0
while True:
@dbrant
dbrant / CatchNameNotFoundException.jaja
Created Feb 19, 2016
Sketch of catching exception when WebView is being updated.
View CatchNameNotFoundException.jaja
@Override
protected void onStart() {
try {
super.onStart();
} catch (Throwable t) {
if (ThrowableUtil.throwableContainsException(t, PackageManager.NameNotFoundException.class)) {
// This can happen when the system updates the WebView component. There's a
// brief window of time when the old WebView is uninstalled from the package
// manager, and the new one is not yet installed, so it literally doesn't exist.
@dbrant
dbrant / ImagePipelineStreamGetter.java
Last active Feb 3, 2016
Get stream from Fresco image pipeline.
View ImagePipelineStreamGetter.java
private abstract class ImagePipelineStreamGetter {
private String imageUrl;
public ImagePipelineStreamGetter(String imageUrl) {
this.imageUrl = imageUrl;
}
public abstract void onSuccess(InputStream stream);
public abstract void onError(Throwable t);
@dbrant
dbrant / symbology
Last active Dec 28, 2015
Useful symbols
View symbology
ligature: ff fi fl ffi ffl
hyphen: ‐
non-breaking hyphen: ‑
minus sign: −
figure dash: ‒
en dash: –
em dash: —
horizontal bar: ―
You can’t perform that action at this time.