Skip to content

Instantly share code, notes, and snippets.

View khilnani's full-sized avatar

Nik Khilnani khilnani

View GitHub Profile
@jsbain
jsbain / find_orphans.py
Created October 19, 2016 03:38
find_orphans.py
from dulwich.repo import Repo
from dulwich.objects import Commit,Tree
import time
def find_lost_commits():
r=Repo('.')
o=r.object_store
all_commits=[]
all_trees=[]
for sha in o:
@omz
omz / EmbedPyui.py
Last active December 21, 2021 21:17
EmbedPyui.py
# coding: utf-8
'''
This is a little helper script to make it easier
to create single-file scripts with Pythonista, while
still taking advantage of the UI editor.
It'll essentially convert the .pyui file to a compact
string representation that you can embed directly
in your script. The code to unpack and load the UI
is also auto-generated for convenience.
@omz
omz / File Picker.py
Created February 22, 2016 03:14
File Picker.py
# coding: utf-8
import ui
import os
from objc_util import ObjCInstance, ObjCClass
from operator import attrgetter
import time
import threading
import functools
import ftplib
import re
@omz
omz / Add Web Tab.py
Last active December 3, 2023 23:33 — forked from steventroughtonsmith/Add Web Tab.py
Insert a custom browser tab into Pythonista
# coding: utf-8
from objc_util import *
import console
import urllib
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@SebastianJarsve
SebastianJarsve / indentation.py
Created August 13, 2014 06:51
To use with Pythonista
import editor, console
script = editor.get_text()
selection = editor.get_selection()
selected_text = script[selection[0]:selection[1]].splitlines()
indentation = int(console.input_alert('Indent'))
replacement = []
for line in selected_text:
if indentation > 0:
@SpotlightKid
SpotlightKid / MarkdownPDF.py
Last active August 25, 2023 20:55
Markdown to PDF Conversion for Pythonista
# Markdown to PDF Conversion
#
# This script converts Markdown markup to PDF directly on your iOS device.
#
# Please see the "Requirements" section in the docstring below for required
# dependencies and the "Installation" section for instructions on how to
# install them.
#
# Run this script directly or put it into the Pythonista editor action menu
# with one of the following options as the first and sole argument:
@cclauss
cclauss / watch_pythonista_forum.py
Last active November 25, 2020 17:27
Learning how to use feedparser... recent_entries() will print out info on all posts to the Pythonista forum in the past 24 hours. watch_feed() will print out info on the last post to the Pythonista forum. Sleeps for 15 minutes then check to see if there is a newer post. If so, prints out info on it and opens its URL in the webbrowser. Repeat.
#!/usr/bin/env python
'''
recent_entries() will print out info on all posts to the Pythonista forum in the past 24 hours.
watch_feed() will print out info on the last post to the Pythonista forum.
Sleeps for 15 minutes then check to see if there is a newer post.
If so, prints out info on it and opens its URL in the webbrowser. Repeat.
'''
@MoOx
MoOx / gulpfile.js
Last active November 4, 2021 10:19
///
var pkg = require("./package.json")
, rimraf = require("rimraf")
, gulp = require("gulp")
, gutil = require("gulp-util")
, filter = require("gulp-filter")
, plumber = require("gulp-plumber")
, concat = require("gulp-concat")
gulp.task("clean", function() {
@marcoslin
marcoslin / .gitignore
Last active August 31, 2023 15:37
Encryption: From PyCrypto to CryptoJS
source.sh
@truppelito
truppelito / Calculator Pro.py
Last active October 15, 2017 08:34
Script for a full-fledged calculator on the iPhone using the perfect Pythonista app.
from scene import *
from sound import *
from math import *
from random import random
import clipboard
FONT = 'HelveticaNeue-Bold'
PADDING = 6
COLORS = ((1,1,1),(0.8,0,0),(0,0,0.9),(0,0.7,0),(0.6,0.1,0.6),(1,0,0),(0.8,0.8,0),(0.9,0.5,0),(0.2,0.2,0.2))
TEXT1_HEIGHT = 20