This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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"; } ' | |
| } |
Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.
When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:
ProxyCommand nc -x localhost:1080 %h %p
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| */ | |
| package com.mypackage.utilities; | |
| import java.lang.reflect.Method; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.apache.commons.lang.builder.EqualsBuilder; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir ~/.pip | |
| cat <<EOF > ~/.pip/pip.conf | |
| [global] | |
| trusted-host = mirrors.aliyun.com | |
| index-url = http://mirrors.aliyun.com/pypi/simple | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.crypto.Cipher; | |
| class Test { | |
| public static void main(String[] args) { | |
| try { | |
| System.out.println("Hello World!"); | |
| int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES"); | |
| System.out.println(maxKeyLen); | |
| } catch (Exception e){ | |
| System.out.println("Sad world :("); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE | |
| SQLRUN STRING DEFAULT ''; | |
| CREATE TEMP FUNCTION | |
| ga4_firebase( key1 STRING, | |
| params ARRAY <STRUCT <key STRING, | |
| value STRUCT <string_value STRING, | |
| int_value INT64, | |
| float_value FLOAT64, | |
| double_value FLOAT64 >>>) AS ( ( | |
| SELECT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TEMP FUNCTION | |
| PROPER(str STRING) AS (( | |
| SELECT | |
| STRING_AGG(CONCAT(UPPER(SUBSTR(w,1,1)), LOWER(SUBSTR(w,2))), ' ' | |
| ORDER BY | |
| pos) | |
| FROM | |
| UNNEST(SPLIT(str, ' ')) w | |
| WITH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| date, | |
| COUNT(DISTINCT(visitid)) as unique_visits | |
| FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*` | |
| WHERE _table_suffix = '20170801' # use date_sub to programmatically select your table | |
| GROUP BY date | |
| ORDER BY date |