Skip to content

Instantly share code, notes, and snippets.

View zxkane's full-sized avatar

Mengxin Zhu zxkane

View GitHub Profile
@HughJeffner
HughJeffner / CompositeX509TrustManager.java
Last active June 9, 2022 21:01
Trust both system KeyStore and custom KeyStore on Android
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.List;
@filipenf
filipenf / aws-s3-buckets-with-tags.sh
Created April 22, 2015 18:46
Print a list of aws buckets along with their tags
#!/bin/bash
# lists all buckets along with their tags in the following format:
# bucket_name | { tag_name: tag_value }
# depends on AWS CLI and JQ
for bucket in `aws s3api list-buckets | jq .Buckets[].Name | tr -d \"`; do
tags=$(aws s3api get-bucket-tagging --bucket $bucket | jq -c '.[][] | {(.Key): .Value}' | tr '\n' '\t')
echo $bucket '|' $tags
done
@odev79
odev79 / index.html
Last active June 19, 2018 22:44
Video.js Example Embed - Reloaded
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Oscar Estrada">
<meta name="viewport" content="width=device-width" />
<title>Video.js Example Embed</title>
<script src="http://vjs.zencdn.net/5-unsafe/video.js"></script>
<link rel="stylesheet" href="https://vjs.zencdn.net/5-unsafe/video-js.css" type="text/css">
@ngpestelos
ngpestelos / remove-docker-containers.md
Last active August 20, 2024 19:34
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@vnykmshr
vnykmshr / pure-ftpd-setup.sh
Created March 28, 2014 12:08
Pure-ftpd server on EC2 Ubuntu Server
apt-get update
apt-get install pure-ftpd
# Ensure
# File /etc/inetd.conf has `ftp` commented out
# File /etc/default/pure-ftpd-common STANDALONE_OR_INETD=standalone
# Add ftp users group
groupadd ftpusers
@fappel
fappel / DisplayHelper.java
Last active January 4, 2017 05:32
JUnit 4 TestRule to ease SWT Display Tests (Dependencies: JUnit, SWT, Guava)
import static com.google.common.collect.Iterables.toArray;
import static com.google.common.collect.Lists.newLinkedList;
import static java.util.Arrays.asList;
import java.util.Collection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.junit.rules.TestRule;
@tianhonghui
tianhonghui / evilConvertor
Last active December 27, 2015 15:29
mars loc to true loc…
using System;
namespace Helpers {
public class LocConverter {
public static double pi = Math.PI;
//
// Krasovsky 1940
//
// a = 6378245.0, 1/f = 298.3
@joeyAghion
joeyAghion / mongodb_collection_sizes.js
Last active February 25, 2025 16:33
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
@WeptunUser
WeptunUser / floatsign.sh
Last active January 1, 2022 21:23 — forked from mediabounds/floatsign.sh
Now fix when no entitlements are present.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
# Extension Copyright (c) 2013 Weptun Gmbh
# http://www.weptun.de
#
# Extended by Ronan O Ciosoig January 2012
#
# Extended by Patrick Blitz, April 2013
@alokc83
alokc83 / xcode-build-number-generator.sh
Last active August 25, 2021 07:57
Automaticvally create build number every time using curent day, month and year
#!/bin/sh
# xcode-build-number-generator.sh
# @desc Automaticvally create build number every time using curent day, month and year
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"