Skip to content

Instantly share code, notes, and snippets.

View juntalis's full-sized avatar

Charles Grunwald juntalis

View GitHub Profile
@juntalis
juntalis / toggl-api-extractor.js
Created October 5, 2012 23:23
Toggl API Extractor
// Run this on the Toggl API page (https://www.toggl.com/public/api) from your javascript console. (In a modern browser)
// Dirty as hell, but I didn't expect to actually add a UI.
function OnLoad() {
var rgxp = /(?:-d ("|)(.*?)\1)? -X (POST|GET|PUT|DELETE) (https:\/\/www\.toggl\.com\/api\/v\d\/[^ \r\n\t]+)\s*$/ig,
typof = function(x) { var s, t = typeof(x); return t === 'object' ? (s = Object.prototype.toString.call(x)).substring(8, s.length - 1).toLowerCase() : t; },
resultWrap = $('<div />').css({
position: 'fixed',
left: Math.floor(($(window).innerWidth() * 0.2) / 2) + 'px',
top: Math.floor(($(window).innerHeight() * 0.2) / 2) + 'px',
@juntalis
juntalis / setup.py
Created October 20, 2012 08:25
PyCmd Setup Script Fix Attempt
from cx_Freeze import setup, Executable
from os import path
setup(
name = 'PyCmd',
version = '0.8',
description = 'Smart windows shell',
executables = [
Executable('PyCmd.py',
initScript=path.join(path.abspath(path.dirname(__file__)), 'pycmd_cx_initscript.py')
#------------------------------------------------------------------------------
# Console.py
# Initialization script for cx_Freeze which manipulates the path so that the
# directory in which the executable is found is searched for extensions but
# no other directory is searched. It also sets the attribute sys.frozen so that
# the Win32 extensions behave as expected.
#------------------------------------------------------------------------------
import os
import sys
@juntalis
juntalis / cx_Freeze__init__.py
Created October 25, 2012 00:10
PyCmd tcl/tk fix
import os
import sys
import zipimport
sys.frozen = True
sys.path = sys.path[:4]
m = __import__("__main__")
importer = zipimport.zipimporter(INITSCRIPT_ZIP_FILE_NAME)
if INITSCRIPT_ZIP_FILE_NAME != SHARED_ZIP_FILE_NAME:
@juntalis
juntalis / rdll.py
Created October 25, 2012 16:40
Remote DLL
#!/usr/bin/env python
# encoding: utf-8
"""
rdll.py
Created by Charles on 10/25/12.
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
@juntalis
juntalis / pytab.py
Created October 25, 2012 19:06
Declarations
# c_void_p PyMem_Malloc(c_size_t)
PyMem_Malloc = _dll.PyMem_Malloc
PyMem_Malloc.restype = c_void_p
PyMem_Malloc.argtypes = [ c_size_t ]
# c_void_p PyMem_Realloc(c_void_p, c_size_t)
PyMem_Realloc = _dll.PyMem_Realloc
(function (global, doc) {
var boxTree,
head,
basename = "InsertedWidget",
untilResultGood = function (checkFunc, callback) {
var args = arguments,
func = args.callee,
caller = func.caller,
check = checkFunc();
if (!check) {
BITS 32
%include 'type-conversion.asm'
section .bss
global _hDllBase
_hDllBase resd 1
SECTION .data
sDllName db u('procrewriter.dll'), 0
SECTION .text
# -*- coding: utf-8 -*-
import mox
import subprocess
try:
import unittest2 as unittest
except ImportError:
import unittest
@juntalis
juntalis / bash.c
Created November 19, 2012 20:15
MSYS bash stub
#include <WinSDKVer.h>
#define _MBCS 1
#define MBCS 1
// Target Windows 2000 & higher
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
// Speed up build process with minimal headers.