Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lishi He ikbear

🏠
Working from home
Block or report user

Report or block ikbear

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ikbear
ikbear / concurrency-in-go.md
Created Dec 31, 2015 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy
View concurrency-in-go.md
@ikbear
ikbear / remove-docker-containers.md
Created Nov 18, 2015 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
View remove-docker-containers.md
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@ikbear
ikbear / idle.sh
Last active Jul 8, 2019
Docker image entrypoint idle script
View idle.sh
#!/bin/bash
echo "This is a idle script (infinite loop) to keep container running."
echo "Please replace this script."
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
@ikbear
ikbear / docker-clean-image.sh
Created Oct 20, 2015
Docker cleanup script
View docker-clean-image.sh
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
@ikbear
ikbear / gist:bcfc3b814f0e70bcc436
Created Oct 1, 2015 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan Developer Preview 2
View gist:bcfc3b814f0e70bcc436

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
View loop.sh
-------- start loop --------
2015/09/30 15:27:36.745404 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/sched.go:303"] active!
2015/09/30 15:27:36.746252 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:55"] loadNodesMeta Normal 1 | ReservedNormal 0
2015/09/30 15:27:36.746267 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:56"] loadNodesMeta Offline 0 | ForcedOffline 0
2015/09/30 15:27:36.746274 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:57"] loadNodesMeta Clear 0
2015/09/30 15:27:36.746797 [D][SCD][#1443598056][172.17.0.4]["qiniu.com/qcos/kernel.v3/sched/pick.go:144"] Real <cpu> 0.091 core / 1.000 core = 0.09 <mem> 466.8 MB / 1.956 GB = 0.23 <ls> 16 <bs> 14
2015/09/30 15:27:36.751137 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:380"] check the 0 of 1 pod(s) from app 10000
2015/09/30 15:27:36.751338 [D][SCD][#1443598056][C_0]["qiniu.com/qcos/kernel.v3/sched/pick.go:328"] loadDirtyPods dirty pods(all): 1
2015/09/30 15
@ikbear
ikbear / gist:14e8efe091e9ed33ecc0
Created Sep 22, 2015 — forked from paulirish/gist:4158604
Learn JavaScript concepts with recent DevTools features
View gist:14e8efe091e9ed33ecc0

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@ikbear
ikbear / what-forces-layout.md
Created Sep 22, 2015 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
You can’t perform that action at this time.