Skip to content

Instantly share code, notes, and snippets.

View ilovejs's full-sized avatar
🐡

Hao ilovejs

🐡
  • 13:19 (UTC +10:00)
View GitHub Profile
@ilovejs
ilovejs / vowpal-hash.lhs
Created June 1, 2016 06:53 — forked from cartazio/vowpal-hash.lhs
vowpal hash
\begin{code}
{-# LANGUAGE BangPatterns #-}
{-|
Module : Data.Digest.VowpalHash
Copyright : (c) Carter Tazio Schonwald
License : BSD-style
Maintainer : first dot last @gmail.com
@ilovejs
ilovejs / progress-bar.sh
Created August 6, 2016 16:26 — forked from F1LT3R/progress-bar.sh
Bash Progress Bar
#!/bin/bash
# Bash Progress Bar: https://gist.github.com/F1LT3R/fa7f102b08a514f2c535
progressBarWidth=20
# Function to draw progress bar
progressBar () {
# Calculate number of fill/empty slots in the bar
@ilovejs
ilovejs / isohybrid.pl
Created October 3, 2016 02:38 — forked from jsarenik/isohybrid.pl
isohybrid.pl from Syslinux-6.03
#!/usr/bin/perl
## -----------------------------------------------------------------------
##
## Copyright 2002-2008 H. Peter Anvin - All Rights Reserved
## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
## Boston MA 02111-1307, USA; either version 2 of the License, or
@ilovejs
ilovejs / gist:56b8ef100f1c1572df88b067f61967ec
Created July 2, 2018 06:51 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@ilovejs
ilovejs / rds.sh
Created July 2, 2018 06:52 — forked from onyxraven/rds.sh
Amazon RDS Performance Tuning Settings
#XLarge DBInstanceClassMemory = 15892177440 = 14.8GB
#/32 = 496630545 = 473MB
#/64 = 248315272 = 236MB
#/128 = 124157636 = 118MB
#/256 = 62078818 = 59MB
#/512 = 31039409 = 29MB
#/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762
#/25165760 = 623 # half of max_connections = 1993.6MB
#/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608
#*(3/4) #default innodb pool size = 11922309120
@ilovejs
ilovejs / platform.sh
Created August 10, 2018 06:17 — forked from saicologic/platform.sh
fork of s3-bash
#!/bin/bash
if [ `uname` = "SunOS" ]; then
alias grep='/usr/gnu/bin/grep'
fi
@ilovejs
ilovejs / hyper.js
Created July 9, 2019 10:02 — forked from coco-napky/hyper.js
Hyper config for git bash in Windows
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@ilovejs
ilovejs / write_once.py
Created April 14, 2020 12:14 — forked from timothycrosley/write_once.py
Write once run every where
"""An example of writing an API to scrape hacker news once, and then enabling usage everywhere"""
import hug
import requests
@hug.local()
@hug.cli()
@hug.get()
def top_post(section: hug.types.one_of(('news', 'newest', 'show'))='news'):
"""Returns the top post from the provided section"""
@ilovejs
ilovejs / balance_test.go
Created September 4, 2020 11:51 — forked from liutianpeng/balance_test.go
消息队列高手课 Mutex,CAS&FAA作业程序
package balance
import (
"runtime"
"sync"
"sync/atomic"
"testing"
)
const MaxCount = 10000
@ilovejs
ilovejs / GLSL-Noise.md
Created September 4, 2020 11:52 — forked from liutianpeng/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}