Skip to content

Instantly share code, notes, and snippets.

View boozook's full-sized avatar
🦀
Dreaming about decentralised GH based on Pijul. 👨🏻‍💻

Alexander Koz. boozook

🦀
Dreaming about decentralised GH based on Pijul. 👨🏻‍💻
View GitHub Profile
@boozook
boozook / GetPID_example.hx
Last active December 31, 2015 21:39
Haxe/Neko. Missed getPID() for NekoVM. Works on mod_neko too.
package com.example;
import sys.io.Process;
/**
* Created by Alex Koz.
* Date: 20.12.13
*/
// TerribleClassNameLOL
class GetPID_example
# Source: https://gist.github.com/4145515
#
# All-purpose gist tool for Pythonista.
#
# When run directly, this script sets up four other scripts that call various
# functions within this file. Each of these sub-scripts are meant for use as
# action menu items. They are:
#
# Set Gist ID.py - Set the gist id that the current file should be
# associated with.
on handle_string(str)
set arrayWithDate to my theSplit(str, "@")
if arrayWithDate's length > 1 then
set theDate to my parseDate(getArrayValue(arrayWithDate, 2))
end if
set arrayWithBody to my theSplit(getArrayValue(arrayWithDate, 1), "#")
if arrayWithBody's length > 1 then
set reminderBody to my getArrayValue(arrayWithBody, 2)
else
#!/usr/bin/env python
import sys, paramiko
if len(sys.argv) < 5:
print "args missing"
sys.exit(1)
hostname = sys.argv[1]
password = sys.argv[2]
@boozook
boozook / evills
Created April 2, 2014 00:37 — forked from Eugeny/evills
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <[email protected]>'
__url__ = 'http://github.com/cburgmer/upsidedown'
@boozook
boozook / pipista.py
Last active August 29, 2015 14:06 — forked from mlgill/pipista.py
import os, os.path, sys, urllib2, requests, gzip, tarfile
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):
@boozook
boozook / Wi-Fi autoselect.scpt
Created November 7, 2014 19:27
Wi-Fi auto-select for "Select network"-popup in OS X
-- Talk with /System/Library/CoreServices/WiFiAgent.app/Contents/MacOS/WiFiAgent
-- For example for my wifi-hotspot named "Wi-Fi":
set myWiFiName to "Wi-Fi. Secure network."
-- Format: "{name}."
-- or if your wifi is closed: "{name}. Secure network." - ( optional variant )
tell application "WiFiAgent"
--activate
tell application "System Events"
tell process "Wi-Fi"
@boozook
boozook / Tools.hx
Last active August 29, 2015 14:18 — forked from nadako/Main.hx
Enum fast extract
class Tools {
public static macro function extract(value:haxe.macro.Expr.ExprOf<EnumValue>, pattern:haxe.macro.Expr) {
return switch (pattern) {
case macro $a => $b:
macro switch ($value) {
case $a:
$b;
default:
throw "no match";
}
@boozook
boozook / Main.hx
Created April 21, 2015 11:00
Haxe possible issue about macro and creation @:to-methods for abstracts.
import haxe.unit.TestRunner;
import haxe.unit.TestCase;
import haxe.Constraints.Function;
import haxe.macro.Printer;
import haxe.macro.Context;
import haxe.macro.Expr;
@boozook
boozook / Main.hx
Last active August 29, 2015 14:21 — forked from savage69kr/Main.hx
class Main {
static function parseProperties(text:String):Map<String, String> {
var map:Map<String, String> = new Map(),
ofs:Int = 0,
len:Int = text.length,
i:Int, j:Int,
endl:Int;
while (ofs < len) {
// find line end offset:
endl = text.indexOf("\n", ofs);