Skip to content

Instantly share code, notes, and snippets.

View kassadin's full-sized avatar
:octocat:
新年好

kassadin

:octocat:
新年好
View GitHub Profile
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
## ubuntu 14.04 清华镜像
#sudo curl -O https://gist.githubusercontent.com/kassadin/bcb1e07863f40f61be5dc5561149856f/raw/8c74bd0d66002940129ce284b816d9af071e6c08/sources.list
sudo wget -P /etc/apt/ https://gist.githubusercontent.com/kassadin/bcb1e07863f40f61be5dc5561149856f/raw/8c74bd0d66002940129ce284b816d9af071e6c08/sources.list
sudo apt-get -y update
sudo apt-get -y install zip unzip git
# sdkman nedd zip unzip
curl -s "https://get.sdkman.io" | bash
@kassadin
kassadin / colors.py
Created May 28, 2017 05:24 — forked from sheljohn/colours-old.py
Print with colors in most shells (Python, standalone)
class ColorPrinter:
"""
Usage:
cprint = ColorPrinter()
cprint.cfg('c','m','bux').out('Hello','World!')
cprint.rst().out('Bye now...')
See: http://stackoverflow.com/a/21786287/472610
See: https://en.wikipedia.org/wiki/ANSI_escape_code
"""
@kassadin
kassadin / resize_window.scpt
Created April 24, 2018 18:36
osx resize window, but how to run it without the editor?
-- set screenWidth to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $2}'")
-- set screenHeight to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $4}'")
on run argv
set {width, height, scale} to words of (do shell script "system_profiler SPDisplaysDataType | awk '/Built-In: Yes/{found=1} /Resolution/{width=$2; height=$4} /Retina/{scale=($2 == \"Yes\" ? 2 : 1)} /^ {8}[^ ]+/{if(found) {exit}; scale=1} END{printf \"%d %d %d\\n\", width, height, scale}'")
log width
log height
log scale
@kassadin
kassadin / docker-for-mac.md
Created May 4, 2018 19:44 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@kassadin
kassadin / generatepublicresources.gradle
Created October 17, 2019 09:35 — forked from HannahMitt/generatepublicresources.gradle
This is a gradle task to generate the public.xml file in an Android library project. It assumes all public resources are kept in a res-public/ resource source directory. Providing this as a starting point, but there may be more efficient ways.
import groovy.xml.MarkupBuilder
// Task to generate our public.xml file
// See https://developer.android.com/studio/projects/android-library.html#PrivateResources
// We assume resources within res-public are public
task generatepublicxml {
def resDir = project.projectDir.absolutePath + "/src/main/res-public"
// Include the desired res types