Skip to content

Instantly share code, notes, and snippets.

View mrmoneyc's full-sized avatar

Chun-Ping (Jeremy) Chang mrmoneyc

View GitHub Profile
@Treeki
Treeki / TurnipPrices.cpp
Last active April 12, 2025 17:09
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@nanmu42
nanmu42 / pkcs7padding.go
Last active October 3, 2023 06:55
Golang PKCS7 Padding/Unpadding
// pkcs7strip remove pkcs7 padding
func pkcs7strip(data []byte, blockSize int) ([]byte, error) {
length := len(data)
if length == 0 {
return nil, errors.New("pkcs7: Data is empty")
}
if length%blockSize != 0 {
return nil, errors.New("pkcs7: Data is not block-aligned")
}
padLen := int(data[length-1])
@turtlemonvh
turtlemonvh / Makefile
Last active March 20, 2025 09:03
Golang Project Makefile Template
# Borrowed from:
# https://github.com/silven/go-example/blob/master/Makefile
# https://vic.demuzere.be/articles/golang-makefile-crosscompile/
BINARY = superdo
VET_REPORT = vet.report
TEST_REPORT = tests.xml
GOARCH = amd64
VERSION?=?
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active February 20, 2025 16:38
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@dannvix
dannvix / CanvasFileSystem.html
Created May 12, 2015 15:04
Experiments on HTML 5 Canvas and File System APIs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML 5 Canvas & File System</title>
<style>
button,
#canvas {
cursor: pointer;
}
@steeve
steeve / _readme.md
Last active March 25, 2025 07:32
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@Halama
Halama / AESEncryptor.php
Last active December 6, 2018 16:39
AES Encryption with PKCS7 padding in PHP
<?php
/**
* AES Encryption with PKCS7 padding http://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7
* https://gist.github.com/RiANOl/1077723
* http://php.net/manual/en/function.mcrypt-encrypt.php
* http://stackoverflow.com/questions/7448763/proper-php-mcrypt-encryption-methods
*
* User: martinhalamicek
* Date: 7/8/13
* Time: 3:06 PM
@yorkxin
yorkxin / avoid-jquery-when-possible.md
Created July 7, 2012 13:04
Avoid jQuery When Possible

Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#