Skip to content

Instantly share code, notes, and snippets.

View johnteee's full-sized avatar

John Lee johnteee

  • Taipei
View GitHub Profile
@johnteee
johnteee / nodeos_full_node_setup.txt
Created November 23, 2018 06:51 — forked from cc32d9/nodeos_full_node_setup.txt
nodeos installation with ZFS
apt-get update && apt-get install -y aptitude git lxc-utils zfsutils-linux netfilter-persistent sysstat
# find the partition ID that is linked to the storage serial number.
# This will prevent from losing the partition if disk mapping changes
ls -l /dev/disk/by-id/ | grep sda6
zpool create -f zdata /dev/disk/by-id/wwn-0x600507604092b628236df4851535cef5-part6
## Fixate internal IP address of the container
systemctl stop lxc-net
sed -i -e 's,^.*LXC_DHCP_CONFILE,LXC_DHCP_CONFILE,' /etc/default/lxc-net
@johnteee
johnteee / installvagrant
Created November 12, 2018 06:44 — forked from rrgrs/installvagrant
installs brew, virtualbox, and vagrant in osx
if ! type "brew" > /dev/null; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
fi
brew tap phinze/homebrew-cask && brew install brew-cask;
brew cask install vagrant;
brew cask install virtualbox;
@johnteee
johnteee / JohnCoin.sol
Created November 6, 2018 05:45
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.24;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
@johnteee
johnteee / html2doku
Created October 8, 2018 13:18 — forked from weirdpercent/html2doku
Perl script to convert HTML to Dokuwiki markup using the HTML::WikiConverter module
#!/usr/bin/perl -w
# Perl script to convert HTML files to DokuWiki Markup.
# Requires HTML::WikiConverter Perl module
use HTML::WikiConverter;
print "HTML to DokuWiki markup converter\n";
my $argcnt = $#ARGV + 1;
if ($argcnt == 2) {
print "Converting...";
function random_chinese_name() {
function random(a, l) {
var x = [];
x.push(a[Math.ceil(Math.random() * a.length)]);
while(l > 1) {
x.push(a[Math.ceil(Math.random() * a.length)]);
l--;
}
return x.join("");
}
@johnteee
johnteee / UIView+backgroundImage.swift
Created September 30, 2018 14:50 — forked from mukhortov/UIView+backgroundImage.swift
Add background image to UIView
import UIKit
extension UIView {
func backgroundImage(named: String) {
let backgroundImage = UIImageView(frame: self.frame)
backgroundImage.image = UIImage(named: named)
backgroundImage.contentMode = .scaleAspectFill
backgroundImage.translatesAutoresizingMaskIntoConstraints = false
backgroundImage.center = self.center
backgroundImage.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleBottomMargin]
@johnteee
johnteee / index.html
Created September 20, 2018 03:55 — forked from Hexrays/index.html
A CodePen by Jeffd. 3D Rotating Cube - based on this tutorial http://davidwalsh.name/css-cube?utm_source=html5weekly&utm_medium=email
<div class="wrap">
<div class="cube">
<div class="front">front</div>
<div class="back">back</div>
<div class="top">top</div>
<div class="bottom">bottom</div>
<div class="left">left</div>
<div class="right">right</div>
</div>
</div>
@johnteee
johnteee / nginx-tuning.md
Created September 19, 2018 03:01 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

char *x; // x: a pointer to char
char x[3]; // x: an array[3] of char
char x(); // x: a function() returning char
char *x[3]; // x: an array[3] of pointer to char
char (*x)[3]; // x: a pointer to array[3] of char
char **x; // x: a pointer to pointer to char
char *x(); // x: a function() returning pointer to char
char *x()[3]; // x: a function() returning array[3] of pointer to char
char (*x[])(); // x: an array[] of pointer to function() returning char
char (*x())(); // x: a function() returning pointer to function() returning char

Shattering Images

I tried to make a gallery, but the images keep shattering when I click on them... I'll need to use more sturdy materials next time.

(Delaunay triangulation part 2)

A Pen by Szenia Zadvornykh on CodePen.