Skip to content

Instantly share code, notes, and snippets.

@nickelpro
nickelpro / yggdrasil.py
Created October 16, 2013 21:51
Yggdrasil Authentication implementation for Minecraft, implements all known Yggdrasil methods and is a lot simpler than some of the other implementations floating around
import urllib.request as request
from urllib.error import HTTPError
import json
class YggAuth:
def __init__(self,
client_token=None,
access_token=None,
username=None,
password=None
@also
also / gist:7729708
Last active June 1, 2021 09:02
how does /usr/libexec/java_home work?
# /usr/libexec/java_home -X
$ sudo opensnoop -n java_home
UID PID COMM FD PATH
501 79809 java_home 3 /System/Library/PrivateFrameworks/JavaLaunching.framework/Versions/A/JavaLaunching
501 79809 java_home 3 /dev/dtracehelper
501 79809 java_home 4 /System/Library/CoreServices/SystemVersion.bundle//English.lproj
501 79809 java_home -1 /System/Library/CoreServices/SystemVersion.bundle//Base.lproj
501 79809 java_home 4 /System/Library/CoreServices/SystemVersion.bundle/English.lproj/SystemVersion.strings
501 79809 java_home -1 /System/Library/CoreServices/SystemVersion.bundle/English.lproj/SystemVersion.stringsdict
501 79809 java_home 3 /usr/share/icu/icudt51l.dat
@victorquinn
victorquinn / promise_while_loop.js
Last active March 30, 2023 04:29
Promise "loop" using the Bluebird library
var Promise = require('bluebird');
var promiseWhile = function(condition, action) {
var resolver = Promise.defer();
var loop = function() {
if (!condition()) return resolver.resolve();
return Promise.cast(action())
.then(loop)
.catch(resolver.reject);
@timyates
timyates / wheee.groovy
Created January 27, 2014 12:51
Spinner whilst parsing files in Groovy on the command line
@Grab( 'com.bloidonia:groovy-common-extensions:0.5.5' )
@Grab('com.xlson.groovycsv:groovycsv:1.0')
import static com.xlson.groovycsv.CsvParser.parseCsv
import groovy.transform.*
// A bufferedReader with some output
@InheritConstructors
class SpinnerReader extends BufferedReader {
private String output = '/-\\|'
private int offset = 0
import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
@jixunmoe
jixunmoe / IntervalLoop.js
Last active November 26, 2018 13:38
Interval Loop (Loop array with delay & callback)
var IntervalLoop = function (arrData, looper, delay) {
if (!(this instanceof IntervalLoop))
return new IntervalLoop (arrData, looper, delay);
/**
* Status
* @type Number
* 0: 循环未开始
* 1: 正在循环
* 2: 循环结束
@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
// Replacement module for Standalone Input Module
// Up to date for Unity 4.6 beta 19
//
// Usage:
// -Remove the standalone module from your event system
// -Add this instead
// -Include ExtraMouseEvents.cs and IExtraMouseEventsHandler.cs
// -Implement IRightPointerClickHandler, IRightPointerDownHandler, IRightPointerUpHandler, IMiddlePointerClickHandler,
// IMiddlePointerDownHandler and/or IMiddlePointerUpHandler.
//
using UnityEngine;
using UnityEngine.EventSystems;
public static class ExtraMouseEvents
{
/// <summary>
/// Right mouse-click
/// </summary>
/// <param name="handler">Handler.</param>
/// <param name="data">Data.</param>