Skip to content

Instantly share code, notes, and snippets.

View KillerGoldFisch's full-sized avatar

Kevin Gliewe KillerGoldFisch

View GitHub Profile
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication
drive = GoogleDrive(gauth)
file1 = drive.CreateFile({'title': 'Hello.txt'}) # Create GoogleDriveFile instance with title 'Hello.txt'
file1.SetContentString('Hello World!') # Set content of the file from given string
file1.Upload()
@KillerGoldFisch
KillerGoldFisch / megautils.py
Created April 20, 2015 15:48
A few helper for the mega API
import os
import time
def _sleep():
time.sleep(1.0)
class MegaNode(object):
"""docstring for MegaNode"""
def __init__(self, mega, id, parent, datainfo):
super(MegaNode, self).__init__()
@KillerGoldFisch
KillerGoldFisch / nodemcu-uploader.py
Created May 15, 2015 14:58
New implementation of the NodeMCU Uploader script (only upload)
#!/usr/bin/env python
# Copyright (C) 2015 Peter Magnusson
# Modified by KillerGoldFisch 2015-05-15
# Version 1.00.001
# For NodeMCU version 0.9.4 build 2014-12-30 and newer.
import os
import serial
import sys
#!/usr/bin/env python
# encoding: utf-8
# http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output
import logging
# now we patch Python code to add color support to logging.StreamHandler
def add_coloring_to_emit_windows(fn):
# add methods we need to the class
def _out_handle(self):
import eyed3
import re
import glob
def get_lyric(lrc):
text = open(lrc).read()
text = re.sub(r'(?:\[.*\])+', '', text).strip()
text = map(lambda l: l.strip(), text.split('\n'))
ans = []
for l in text:
@KillerGoldFisch
KillerGoldFisch / server.py
Last active January 20, 2021 14:18
Flask server for static directorys with filebrowser
#!/usr/bin/python
#
# Flask server, woo!
#
from flask import Flask, abort, send_file, render_template_string
import os
# Setup Flask app.
app = Flask(__name__)

DocGist Example

DocGist is a tool that renders AsciiDoc documents fetched from GitHub gists or other sources. The rendering is performed in the browser using the asciidoctor.js library. The original use case for this was http://gist.neo4j.org/ which has additional features to create examples for the Neo4j graph database.

How To Use

  • Create/locate a gist on GitHub (or use a file in Dropbox).

    • Write text using AsciiDoc syntax in it.

@KillerGoldFisch
KillerGoldFisch / build.gradle.groovy
Last active October 20, 2016 04:35
Gradle script to inject version/git informations
///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// TEMPLATE /////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
// Get Git informations
def branch = "git rev-parse --abbrev-ref HEAD".execute().text.trim()
def revision = "git rev-parse --short HEAD".execute().text.trim()
def origin = "git config --get remote.origin.url".execute().text.trim()
def timestamp = new Date().format("yyyy-MM-dd HH:mm:ss")
@KillerGoldFisch
KillerGoldFisch / WinScheduler.bat
Last active March 30, 2016 14:07
Run Task at user logon with highest privileges
schtasks /delete /tn TASKNAME /f
SCHTASKS /CREATE /TN TASKNAME /TR "%SYSTEMROOT%\TASK.exe" /SC onlogon /RU %USERDOMAIN%\%USERNAME% /RL HIGHEST /f
rem SCHTASKS /CREATE /TN TASKNAME /TR "%SYSTEMROOT%\TASK.exe" /SC onstart /RU %USERDOMAIN%\%USERNAME% /RL HIGHEST /f
SCHTASKS /Run /TN TASKNAME
@KillerGoldFisch
KillerGoldFisch / winvars.groovy
Last active March 31, 2016 17:16
Modify Windows variables in Groovy
/*
// EXAMPLE:
GroovyShell shell = new GroovyShell()
def v = shell.parse(new File(/H:\scripts\winvars.groovy/))
println v.addPATH([
/H:\Software\gradle-2.10\bin/,
/H:\Software\groovy-2.4.5\bin/,
/H:\Software\kotlinc\bin/,
/H:\Software\emsdk-1.35.0-portable-64bit/,