Skip to content

Instantly share code, notes, and snippets.

@jingyuyao
jingyuyao / mysql_size.sh
Created June 28, 2015 17:42
Display the size of mysql database
read -s -p "MySql root password: " password
echo
mysql -uroot -p${password} -e 'SELECT table_schema "Data Base Name",sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema;'
@jingyuyao
jingyuyao / ListMultimapAdapter.java
Created May 21, 2017 00:59
Gson serializer/deserializer for ListMultimap from Guava
package com.jingyuyao.adapters;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.reflect.TypeToken;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
@jingyuyao
jingyuyao / app.component.html
Last active June 12, 2018 06:37
Angular 6 Google sign-in
<button
*ngIf="isSignedIn$ | async"
(click)="logOut()">
Logout
</button>
<div id="google-signin" [hidden]="isSignedIn$ | async"></div>
<span *ngIf="isSignedIn$ | async; else notSignedIn">
Current user: {{(currentUser$ | async).getBasicProfile().getName()}}
</span>
<ng-template #notSignedIn>