Skip to content

Instantly share code, notes, and snippets.

@t0chas
t0chas / exportPemCertificate.sh
Created July 5, 2017 20:22
Export APNS Certificate as PEM
#!/bin/sh
CERTIFICATE_FROM_APPLE="$1"
CERTIFICATE_KEY="$2"
PASSWORD="$3"
if ! [ -e "$1" ] ; then
echo "CERTIFICATE_FROM_APPLE is missing."
echo "usage:\n\t $0 CERTIFICATE_FROM_APPLE.cer CERTIFICATE_KEY.p12 PASSWORD"
exit 1;
fi
@t0chas
t0chas / land_v2.ks
Created November 30, 2016 03:43
KSP kOS mod - Landing script
RUN ONCE surfaceLib.
DECLARE LOCAL runmode to 0.
DECLARE LOCAL impactTimeDelta to 0.
DECLARE LOCAL impactTimeStamp to 0.
DECLARE LOCAL pos to 0.
DECLARE LOCAL impactGeoPos to 0.
DECLARE LOCAL impactVel to 0.
DECLARE LOCAL deltaV to 0.
DECLARE LOCAL max_acc to 0.
@t0chas
t0chas / ProductItems.cs
Last active November 30, 2016 16:14
Json.Net.Unity3D struct example
[System.Serializable]
public struct ProductItems
{
public static readonly ProductItems Default = default(ProductItems);
public string ProductId { get; set; }
public int Count { get; set; }
public ProductItems(string productId, int count)
{
@t0chas
t0chas / getBuildNumberByDate.go
Created November 23, 2016 16:53
Use the current date as BuildNumber on Xcode projects build with Bitrise.
package main
import (
"fmt"
"os"
"os/exec"
"time"
)
// RunEnvmanAdd ...
@t0chas
t0chas / launch_v4.ks
Last active June 15, 2016 02:05
A kOS script for KSP. Deploy a CommSat to low Kerbin Orbit (LKO) using a kOS script to handle launch, staging and circularization, without having a proper signal relay network (RemoteTech only).
clearscreen.
set headingAngle to 90. //normal EAST
set targetApoapsis to 150000. //Target apoapsis in meters
set targetPeriapsis to 150000. //Target periapsis in meters
lock throttle to 0. //Throttle is a decimal from 0.0 to 1.0
gear off.
set runmode to 0. //Safety in case we start mid-flight
if SHIP:STATUS = "PRELAUNCH"{
set runmode to 1.
@t0chas
t0chas / CustomDefines.cs
Created March 19, 2016 17:21
Manage your Unity3D symbols easily within the Editor by defining menu items
using UnityEngine;
using UnityEditor;
public class CustomDefines {
[MenuItem("Global Defines/My Symbol/Enable")]
public static void EnableDebug(){
Debug.LogWarning("Enabling MY_SYMBOL");
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
string newDefine = "MY_SYMBOL";
@t0chas
t0chas / CustomEditorBase.cs
Last active March 5, 2024 16:47
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{