Skip to content

Instantly share code, notes, and snippets.

View huskyui's full-sized avatar
😀
the world is worth fighting for

huskyui huskyui

😀
the world is worth fighting for
  • ly
  • suzhou,china
View GitHub Profile
@iamvickyav
iamvickyav / docker-compose.yml
Last active April 13, 2024 21:41
docker-compose.yml for MySQL with init script
version : '3'
services:
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
volumes:
@cpeeyush
cpeeyush / JsonUtils.java
Created April 15, 2017 09:09
Common Json Utilities based on jackson
package com.peeyush.common.utils;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
@buchgr
buchgr / Main.java
Created June 24, 2015 19:31
Double-Checked Locking with a Map
class Main {
private final Map<Integer, Object> map = new ConcurrentHashMap<>();
public Object getOnce(int idx) {
Object obj = map.get(idx);
if (obj == null) {
synchronized(this) {
obj = map.get(idx);
if (obj == null) {
obj = new Object();
@alexanderscott
alexanderscott / SETCLAMP.lua
Created January 26, 2015 08:49
Redis Lua script to clamp a value between a min & max
-- @desc: Clamp a value between a min & max
-- @usage: redis-cli EVAL "$(cat SETCLAMP.lua)" 1 <key> <min> <max>
-- @return: clamped value
local function SETCLAMP(key, min, max)
local valStr = redis.call("GET", key)
if not valStr then return end
local val = tonumber(valStr)
if val > max then
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@mattetti
mattetti / gist:3798173
Last active April 16, 2023 03:09
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"https://splice.com/",