Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Gerzer's full-sized avatar

Gabriel Jacoby-Cooper Gerzer

  • Rensselaer Polytechnic Institute
  • Troy, NY
  • 10:05 (UTC -04:00)
  • X @GerzerSoftware
View GitHub Profile
activate application "Discord"
repeat 5 times
tell application "System Events"
repeat 10 times
keystroke "."
key code 36 using shift down
end repeat
key code 36
delay 1
end tell
@Gerzer
Gerzer / valgrind.command
Last active December 9, 2020 23:54
Easily run Valgrind on a remote machine
#!/bin/bash
user="" # Server user
address="" # Server address
ssh $user@$address << ENDSSH
cd ~/
mkdir valgrind/
ENDSSH
scp *.cpp $user@$address:~/valgrind/
scp *.h $user@$address:~/valgrind/
@controversial
controversial / YoutubePiP.py
Created September 20, 2015 17:46
YoutubePiP.py
import appex, bs4, dialogs, urllib2, webbrowser
if appex.is_running_extension():
starturl = appex.get_url()
else:
#ask for video url
starturl = dialogs.form_dialog(fields=[{'type':'url', 'title':'URL:', 'key':'url'}])['url']
#handle redirects, in case of shortened url
url = urllib2.urlopen(urllib2.Request(starturl)).geturl()
#keepvid page url
url = 'http://www.keepvid.com/?url='+url.split('&feature')[0]
@Gerzer
Gerzer / FTP sync.py
Last active January 18, 2018 23:42
Pythonista FTP sync
import ui
import console
import keychain
import ftplib
import os
import re
import time
from datetime import datetime
global cur_dir
cur_dir = os.path.abspath(os.getcwd())
@omz
omz / touchid.py
Last active November 15, 2023 23:35 — forked from alessaba/TouchID.py
TouchID.py
# coding: utf-8
from objc_util import *
import threading
NSBundle = ObjCClass('NSBundle')
LocalAuthentication = NSBundle.bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework')
LocalAuthentication.load()
LAContext = ObjCClass('LAContext')
# authenticate() will raise one of these exceptions when authentication
@yasuoza
yasuoza / LocalProfileInstallServer.swift
Created March 27, 2015 05:21
Install configuration profile through iOS application with CocoaHTTPServer
/*
* Be sure not to close local server at `applicationDidEnterBackground:`.
* This causes file not found error in Safari.
*/
class LocalHTTPConnection: HTTPConnection {
override func httpResponseForMethod(method: String!, URI path: String!) -> NSObject! {
if path == LocalWebViewRouter.Profile.URL.path {
return LocalProfileReponse(filePath: self.filePathForURI(path), forConnection: self)
@LukasKalbertodt
LukasKalbertodt / meta.cpp
Created October 22, 2014 20:33
Template Meta Program to solve the Partial Knapsack Problem (works with clang & gcc)
/**
* --- Template Meta Program to solve the Partial Knapsack Problem ---
*
* This little piece of code solves the partial knapsack problem at compile
* time. This is not useful in any way. I just wanted to discover the
* possibilities of template meta programming.
* Note that this code is absolutly awful. First of all: It's a "pure" template
* meta program, which is ugly on it's own. Furthermore my code is ugly in
* particular. The motivation to clean up super-ugly code to get a little bit
* less ugly code is... not that high.
@Gerzer
Gerzer / Snakeyes.py
Created June 20, 2014 20:51
Snakeyes.py
import editor
full_text = editor.get_text()
cursor = editor.get_selection()[1]
while True:
try:
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'def':
editor.replace_text(cursor, cursor, ' func_name():')
editor.set_selection(cursor + 1, cursor + 10)
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'ifc':
editor.replace_text(cursor, cursor, ' condition:')
@omz
omz / Dropbox File Picker.py
Last active May 17, 2020 21:47
Dropbox File Picker.py
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)
@omz
omz / ShortcutGenerator.py
Created December 9, 2013 11:01
ShortcutGenerator
# This script adds a "Webclip" shortcut to your homescreen.
# The shortcut can be used to open a web page in full-screen mode,
# or to launch a custom URL (e.g. a third-party app).
# You'll be asked for a title, a URL, and an icon (from your camera roll)
import plistlib
import BaseHTTPServer
import webbrowser
import uuid
from io import BytesIO