Skip to content

Instantly share code, notes, and snippets.

@shoghicp
shoghicp / improvements.md
Last active August 16, 2020 19:11
Improvements to External Server adding on Minecraft: PE

As the MCPE team said, they don't want young people find External servers easily. They are a non-controlled area for parents, and would increase the rating of the app (meaning... not recommended for young people). So, there is no problem in making it easier to join servers to the people that want to, while other people will just play the same, right?

Adding Direct Connect, without the list

One way to do so is improving the "Add External Server" screen. Lots of people don't want to have a big list. This can be solved adding a Connect button just below the Add Server button.

Removing defaults

When you add the server details, you have to delete the 127.0.0.1 default value for the Address. The Port one is filled too, but that is mostly unchanged. Just leaving Address empty makes it easier.

URL Protocol

@bg5sbk
bg5sbk / str_replace.c
Created April 18, 2014 18:30
replace string in C
// fork from https://github.com/irl/la-cucina/blob/master/str_replace.c
char* str_replace(char* string, const char* substr, const char* replacement) {
char* tok = NULL;
char* newstr = NULL;
char* oldstr = NULL;
int oldstr_len = 0;
int substr_len = 0;
int replacement_len = 0;
newstr = strdup(string);
@brandonb927
brandonb927 / gist:9587436
Created March 16, 2014 18:13
Simple JSON database with Node.JS

From: http://run-node.com/littlest-database-that-could/

I've written numerous tiny databases. They don't have much features, but they don't need much features. Usually I'm looking for fast simple key/value stores and Node never disappoints. The point here is, why abstract key value store when JS gives us one for free, as it's most basic component: object.

Will it meet every need? No. But it will meet ALOT of scenarios.

In memory JS object lookups, were talking hundreds of thousands of lookups (you'll easily flood http before the db), and save hundreds of thousands of records in a JSON file written to disk. Not a 200ms r/t to some hosted Redis. Hey, that's fine if that's your thing.

Here's the requirements:

@massar
massar / server-git.conf
Created March 6, 2014 21:14
Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# [email protected] - http://jeroen.massar.ch
server {
listen 192.0.1.1:80;
listen [2001:db8::1]:80;
# Redirect all non-HTTPS traffic to the HTTPS variant
return 301 https://$host$request_uri;
}
@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@techtonik
techtonik / findfiles.py
Created June 2, 2013 20:23
Python - case-insensitive glob
# snippet is placed into public domain by
# anatoly techtonik <[email protected]>
# http://stackoverflow.com/questions/8151300/ignore-case-in-glob-on-linux
import fnmatch
import os
import re
def findfiles(which, where='.'):
@shoghicp
shoghicp / 0.6.1.txt
Created May 17, 2013 19:55
Minecraft: Pocket Edition 0.6.1 protocol
# Minecraft PE v0.6.1 alpha Protocol #9
# 49 identified Packets
[C ==> S] 0x82 LoginPacket (String, int, int)
[C <== S] 0x83 LoginStatusPacket (int)
[C ==> S] 0x84 ReadyPacket (bits[8])
[C <== S] 0x85 MessagePacket (String)
[C <== S] 0x86 SetTimePacket (long)
[C <== S] 0x87 StartGamePacket (long, int, int, int, float, float, float)
[C <== S] 0x88 AddMobPacket (int, int, float, float, float, byte, byte, Metadata)
@gibiansky
gibiansky / regfile.v
Created December 10, 2012 17:30
Register File Verilog Module
module regfile(input clock, input [2:0] address, input en_write, inout [7:0] data);
// Register file storage
reg [7:0] registers[7:0];
// Read and write from register file
always @(posedge clock)
if (en_write)
registers[address] <= data;
else
@abulte
abulte / bootstrap.sh
Created October 19, 2012 10:21
Build a custom RPI image
#!/bin/bash
# Based on work by Klaus M Pfeiffer at http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/
# you need to do: "sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools"
# run with "sudo bootstrap.sh /dev/sd[x]"
echo "Use like: sudo bootstrap.sh /dev/sd[x]"
#deb_mirror="http://ftp.debian.org/debian"
#deb_local_mirror="http://ftp.debian.org/debian"
@mina86
mina86 / aux.c
Last active November 26, 2021 15:00
Code reading auxiliary vector present in executable binary.
#define _GNU_SOURCE
#include <linux/auxvec.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static unsigned long *getauxv(void) {
char **env = environ;