Skip to content

Instantly share code, notes, and snippets.

@wavezhang
wavezhang / java_download.sh
Last active July 15, 2024 09:36
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@jbrown17
jbrown17 / rsa.java
Last active November 2, 2023 00:16
Quick, simple implementation of RSA encryption algorithm without external libraries
import java.awt.EventQueue;
import java.io.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
/**
* Quick and dirty implementation of the RSA algorithm
@calebwoods
calebwoods / nginx.conf
Created May 10, 2014 20:18
Sample Nginx config for deployment of Angular.js app
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
@nikic
nikic / routing_bench.php
Created February 17, 2014 11:46
Microbenchmark between Pux and FastRoute
<?php
error_reporting(E_ALL);
require __DIR__ . '/FastRoute/src/bootstrap.php';
spl_autoload_register(function ($class) {
require __DIR__ . '/Pux/src/' . strtr($class, '\\', '/') . '.php';
});
@edokeh
edokeh / index.js
Last active July 16, 2024 01:43
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@LegendZhu
LegendZhu / gist:5735015
Last active December 18, 2015 05:48
通过PREVIEW_TOTLE、ROW_NUMBER参数控制页面的显示【总数表示标签不足时共显示多少格子】 元素少于配置时的总数空格补位和超过时的补位
<?php
define('PREVIEW_TOTLE', 15);//总数
define('ROW_NUMBER', 3);//每行的个数,应可被TOTLE整除
$total = PREVIEW_TOTLE;
$row = ROW_NUMBER;
$count = count($val['tag_ids']);
$last = $total - $count;
$j = 0;
@epicserve
epicserve / redis_key_sizes.sh
Last active June 29, 2024 03:41
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@jhclark
jhclark / latency.txt
Created May 31, 2012 19:58 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@jboner
jboner / latency.txt
Last active July 17, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD