Skip to content

Instantly share code, notes, and snippets.

View tdamdouni's full-sized avatar

Taha Dhiaeddine Amdouni tdamdouni

View GitHub Profile
# coding: utf-8
import bz2
from base64 import b64decode
data = '''\
QlpoOTFBWSZTWf2rpqIAEq7fgFUQUGd/9T/kmYq/79/6YAifD0d2D50GmgESoe4AOgMGop
6Jpk00GEaPUHqNDTJtTJkZBoAElJgJpglMUBoAAA0DQAA5piYCNMCMIwAAABMIwEppqaoj
QAAABoAD1NAAAEUgQBGJlU8UAAAAAAAClJEEaTTAiIAekB6g0NGgeRH5U4F2UyKh+yh09M
vXptst8B8aGUNqGRLsocKGiNsKyWMwMJkQ4cOPKqKXKoR+CijjlhhhgZIOdSl9e1Q/5jjh
FREATWyXbHkmIyNeRwI4DOb5L1Mwh+YM0AQML5jKxDXfY1K3V9zYz5ZllqGBrMYxmNFrRm
mWUT+2E4EcpGEeD/3s/LauhdZ4hwofD4ee4ceL6sevDEciKPp0lpnNX6kP7fstGzJEpS4Z
#! /usr/bin/env python
#McRoboFlicker.py
# Sound controlled McRoboFace by Robin Newman June 4th 2016
# requires picon zero hardware plus software library
# see circuitry in article at rbnrpi.wordpress.com
import piconzero as pz, time
pz.init()
@jsbain
jsbain / SlideMenu.py
Created June 1, 2016 05:05
SlideMenu.py
# coding: utf-8
# based on @cook code https://forum.omz-software.com/topic/3181/ui-view-and-touch
# uses https://github.com/mikaelho/pythonista-gestures
import ui
from pythonista_gestures.Gestures import Gestures
class SideMenuSlideView(ui.View):
def __init__(self, master_view, detail_view):
#need to instantiate with master and detail subviews as args.
# coding: utf-8
import swizzle
from objc_util import *
import ctypes
import json, urllib
import uuid
import sys
import webbrowser
import urllib
@lukaskollmer
lukaskollmer / get_available_memory.py
Last active October 2, 2023 11:41
Get memory stats in Pythonista using ctypes
#!/usr/bin/env python3
# Copyright (c) 2016 Lukas Kollmer<[email protected]>
from ctypes import *
from objc_util import ObjCClass
NSProcessInfo = ObjCClass('NSProcessInfo')
NSByteCountFormatter = ObjCClass('NSByteCountFormatter')
@gbaman
gbaman / HowToOTGFast.md
Last active April 11, 2025 22:53
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@rcugut
rcugut / node-npm-install.md
Last active February 2, 2024 11:51 — forked from DanHerbert/fix-homebrew-npm.md
Install node & npm on Mac OS X with Homebrew

DEPRECATED as of macOS 10.13 (High Sierra). See the new GUIDE to install nvm and yarn for macOS (updated July 2019)

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

@transilluminate
transilluminate / display.py
Created February 29, 2016 01:51
Raspberry Pi Display-O-Tron 3000 System Info Display
#!/usr/bin/env python
import time, colorsys, psutil, subprocess
import dot3k.lcd as lcd
import dot3k.backlight as backlight
from dot3k.menu import Menu, MenuOption
def run_cmd(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.communicate()[0].rstrip()
@BenjyWiener
BenjyWiener / Add Screen Recorder Button.py
Last active September 15, 2017 08:06
Screen recorder for Pythonista
# coding: utf-8
from objc_util import *
from ReplayKit import *
from console import alert
import ui
UIBarButtonItem = ObjCClass('UIBarButtonItem')
def main():
@jsbain
jsbain / notificationplayground.py
Created January 26, 2016 08:50
notificationplayground.py
# coding: utf-8
#. objc from http://www.thinkandbuild.it/interactive-notifications-with-notification-actions/
from objc_util import *
UIUserNotificationSetting = ObjCClass('UIUserNotificationSettings')
UIMutableUserNotificationCategory = ObjCClass('UIMutableUserNotificationCategory')
UIMutableUserNotificationAction = ObjCClass('UIMutableUserNotificationAction')
UIUserNotificationSettings = ObjCClass('UIUserNotificationSettings')
UILocalNotification = ObjCClass('UILocalNotification')