Skip to content

Instantly share code, notes, and snippets.

View fanjieqi's full-sized avatar

fanjieqi fanjieqi

View GitHub Profile
@asyncins
asyncins / snowflake.go
Created July 3, 2020 05:59
[snowflake-go]
package main
import (
"errors"
"fmt"
"sync"
"time"
)
const (
@bluekvirus
bluekvirus / jersey-hibernate-mariadb-tomcat.md
Created January 23, 2017 22:53
Develop a Jersey (Restful Web) Application using Hibernate and MariaDB

Develop a Jersey Application using Hibernate and MariaDB

@credit Yan Zhu (https://github.com/nina-zhu)

Introduction

Jersey is the most popular amongst Restful web service development. Latest Jersey 2.x version has been developed by Oracle/Glassfish team in accordance with JAX-RS 2.0 specification. Earlier Jersey 1.x version was developed and supported by Oracle/Sun team.

Latest Jersey release version is 2.25 see here and look documentation and API for details. We will implement a Jersey example in this article based on latest 2.x version.

In this article, we will use Hibernate's rich API to interact with MariaDB database or in general any ORM compliant database. We will create a

@jazzl0ver
jazzl0ver / notify-mysql-deadlock.sh
Last active March 7, 2021 18:20
Detect mysql deadlocks and notify developers by email. Notification sent on new deadlocks only
#!/bin/bash
#
# Detects mysql deadlocks and notify developers by email
# Notification sent on new deadlocks only
# monuser must have "PROCESS" permission in mysql server
# Set EXCLUDE_PTRN to avoid alerting if the pattern was found
#
host=$1
user=monuser
@lonelycode
lonelycode / tyk_quickstart.sh
Last active December 28, 2022 14:52
Tyk Demo Setup Script
#! /bin/bash
# This script will set up a full tyk environment on your machine
# and also create a demo user for you with one command
# USAGE
# -----
#
# $> ./tyk_quickstart.sh {IP ADDRESS OF DOCKER VM}
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 20:51
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@lfender6445
lfender6445 / gist:9919357
Last active May 2, 2024 22:40
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger