Skip to content

Instantly share code, notes, and snippets.

View kosso's full-sized avatar

Kosso kosso

View GitHub Profile
@kosso
kosso / TiFTPSockets.js
Last active August 24, 2017 00:48
FTP binary data file uploader in Titanium using Sockets
/*
// Author : @kosso
// Date : May 10, 2015.
// FTP binary data file uploader. With notes etc. which I cobbled togethr while trying to work out this elusive dark art.
All examples I found were using the 'STOR' command incorrectly and wondering why they were getting empty files appear (if they were lucky).
Also, most if not all were using the deprecated Ti.Network.createTCPSocket() method instead of Ti.Network.Socket.createTCP().
eg : http://stackoverflow.com/questions/23971311/titanium-appcelerator-ftp-upload
@kosso
kosso / gist:06188d84885fbb57e560
Created December 30, 2015 17:05
scratchpad .. ObjectiveC stuff
// GET and parsing some remote JSON data inside an iOS module for a Titanium app.
// @Kosso
// Test with amazingtunes.com API of recently played tunes on /AmazingRadio/.
NSString *amazingHistory = @"http://amazingtunes.com/radio/history.json";
-(void)getData:(id)args
{
NSLog(@"[INFO] getData");
Setting Up A Localhost Self-signed Certificate For Local Https Development
==========================================================================
- GENERATE THE CERTIFICATE
# 1. generate key
- create an 'ssl' folder somewhere
- cd to it
@kosso
kosso / WP_API_OAuth_Test_client.php
Last active September 16, 2021 05:30
Test PHP client for Wordpress REST API v2.0 / OAuth1.0a 0.3.0
<?php
//opcache_reset(); // Disable local dev MAMP cache
/*
WP_API_OAuth_Test_client.php
Tested with Wordpress 4.7.1
WordPress REST API - OAuth 1.0a Server v.0.3.0 - https://en-gb.wordpress.org/plugins/rest-api-oauth1/
@kosso
kosso / rPi3-ap-setup.sh
Created March 11, 2016 00:08 — forked from Lewiscowles1986/rPi3-ap-setup.sh
Raspberry Pi 3 access-point-setup
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
if [[ $# -ne 1 ]];
then echo "You need to pass a password!"
echo "Usage:"
@kosso
kosso / TiUIAttributedStringProxy.m
Last active August 15, 2016 05:23
Hacked version of TiUIAttributedStringProxy.m to try to add support for ParagraphStyle and Attachment attributed strings.
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2015 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#if defined (USE_TI_UIATTRIBUTEDSTRING) || defined(USE_TI_UIIOSATTRIBUTEDSTRING)
#import "TiUIAttributedStringProxy.h"
#import "TiProxy.h"
#import "TiUtils.h"
import time
import BaseHTTPServer
import requests
# To install requests : git clone git://github.com/kennethreitz/requests.git
# Then [sudo] python setup.py install
# An html renderer subdomain
HOST_NAME = 'html.example.com'
PORT_NUMBER = 80
@kosso
kosso / gist:02d602f7a6335c5bb1053efe1fa4b849
Created June 2, 2016 15:06
FFMPEG resize to 720p command
ffmpeg -i INPUT.mp4 -vf scale=-1:720 -c:v libx264 -crf 18 -preset veryslow -c:a copy OUTPUT.mp4
#!/bin/bash
# Based on Adafruit Learning Technologies Onion Pi project
# More info: http://learn.adafruit.com/onion-pi
if (( $EUID != 0 )); then
echo "This must be run as root. Try 'sudo bash $0'."
exit 1
fi
#!/bin/bash
# Onion Pi, based on the Adafruit Learning Technologies Onion Pi project.
# For more info: http://learn.adafruit.com/onion-pi
#
# To do:
# * Options for setting up relay, exit, or bridge
# * More anonymization of Onion Pi box
# * Further testing
if (( $EUID != 0 )); then