Skip to content

Instantly share code, notes, and snippets.

@ChaosJohn
ChaosJohn / README.md
Created November 20, 2015 03:27 — forked from jnovack/README.md
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --reload
  3. firewall-cmd --add-service=mosh --permanent

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@ChaosJohn
ChaosJohn / Info.plist
Created December 10, 2015 02:22 — forked from aruld/Info.plist
To run Intellij 14.1 with latest JDK 9 on OS X Yosemite, edit /Applications/IntelliJ\ IDEA\ 14.app/Contents/Info.plist and set JVMVersion to 1.8 under JVM Options.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
@ChaosJohn
ChaosJohn / build.gradle
Created December 23, 2015 09:07 — forked from dant3/build.gradle
lombok + gradle
apply plugin: 'java'
apply from: 'provided.gradle'
repositories {
mavenCentral()
}
dependencies {
provided group: 'org.projectlombok', name: 'lombok', version:'1.14.8'
}
@ChaosJohn
ChaosJohn / osx-for-hackers.sh
Created January 5, 2016 06:45 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@ChaosJohn
ChaosJohn / icloud-ssh
Created January 7, 2016 04:20 — forked from skyisle/icloud-ssh
Shell script to connect icloud host through ssh
#!/bin/bash
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hostname"
exit $E_BADARGS
fi
HOSTNAME=$1
DOMAIN=$(echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p')
@ChaosJohn
ChaosJohn / PersistentCookieStore.java
Created April 14, 2016 14:16 — forked from lezorich/PersistentCookieStore.java
Android basic persistent cookie manager for Volley. This cookie store wraps the default CookieManager store to store the session cookie. It use's Gson to json serialize the cookie and store it as a json string in SharedPreferences.
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Lukas Zorich
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@ChaosJohn
ChaosJohn / OkHttpProgressGlideModule.java
Created June 29, 2016 09:56 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
@ChaosJohn
ChaosJohn / brew-cask-upgrade.sh
Created August 22, 2016 06:35 — forked from c00kiemon5ter/brew-cask-upgrade.sh
a portable shell script to upgrade cask packages
#!/bin/sh
help=0
latest=0
verbose=0
status=0
usage() {
cat <<-EOF
${0##*/} [options]
@ChaosJohn
ChaosJohn / ATS.plist
Created September 21, 2016 11:49 — forked from onevcat/ATS.plist
Fuck off ATS
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@ChaosJohn
ChaosJohn / update_gfwlist.sh
Created December 14, 2016 02:38 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)