Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Miron miron

🏠
Working from home
View GitHub Profile
@russjones
russjones / run.sh
Last active Feb 11, 2021
A script to demonstrate Teleport Enhanced Session Recording.
View run.sh
#!/bin/bash
set -euo pipefail
RELEASE="teleport-v4.2.3-linux-amd64-bin.tar.gz"
if [[ $EUID -ne 0 ]]; then
echo "--> Please run this script as root or sudo."
exit 1
fi
@awesomebytes
awesomebytes / ipython_to_file.md
Created Mar 16, 2016
Save iPython session to a python file as code
View ipython_to_file.md

Save an iPython session commands/code to a file

You must use the magic method %save:

In [1]: %save?
Type:       Magic function
String Form:<bound method CodeMagics.save of <IPython.core.magics.code.CodeMagics object at 0x7fb5d25bb1d0>>
Namespace:  IPython internal
File:       /usr/lib/python2.7/dist-packages/IPython/core/magics/code.py
@ywangd
ywangd / psiclient.py
Last active Apr 10, 2020
Proof-of-Concept Client for Pythonista-Script-Index
View psiclient.py
"""
Basic client for Pythonista Script Index (https://github.com/ywangd/Pythonista-Script-Index)
See also: https://github.com/ywangd/psiclient
"""
import platform
import sys
import os
import urllib2
import json
View custom.js
// add this to <profile>/static/custom/custom.js to load vim keybindings:
$.getScript("/static/components/codemirror/keymap/vim.js", function() {
if (! IPython.Cell) return;
IPython.Cell.options_default.cm_config.keyMap = "vim";
});
anonymous
anonymous / Pypi.py
Created Mar 26, 2013
Pypi
View Pypi.py
import urllib
import tarfile
import shutil
import console
import os
class Installer(object):
name = None
version = None
firstLetter = None
View README.rst

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@silverkors
silverkors / fileman.py
Created Nov 27, 2012
Useful filemanager for Pythonista, move files, delete and create files and directories
View fileman.py
# -*- coding: utf-8 -*-
import os, sys, editor, shutil
from glob import glob
from scene import *
from time import time
from copy import deepcopy
from PIL import Image, ImageDraw, ImageFont
# https://gists.github.com/4034526
@pudquick
pudquick / shellista.py
Last active Nov 15, 2020
Advanced shell for Pythonista
View shellista.py
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip
# Credits
#
# The python code here was written by pudquick@github
#
# License
#
# This code is released under a standard MIT license.
#
@pudquick
pudquick / pipista.py
Created Nov 20, 2012
pipista - pip module (for installing other modules) for Pythonista
View pipista.py
import os, os.path, sys, urllib2, requests
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
View ImageMail.py
# Example for sending an email with an attached image using smtplib
#
# IMPORTANT: You need to enter your email login in the main() function.
# The example is prepared for GMail, but other providers
# should be possible by changing the mail server.
import smtplib
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email import encoders