Skip to content

Instantly share code, notes, and snippets.

@zachleat
zachleat / gist:2008932
Created March 9, 2012 21:56
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@benelog
benelog / git.md
Last active January 19, 2021 13:14
버전관리 유랑기, Git 적응기

버전 관리 시스템 유랑기, 그리고 Git 적응기

2011년 6월 9일11월 10일에 열린 세미나에서 두 번 발표했던 내용을 글로 정리했습니다.

지금까지 다양한 버전관리 시스템을 쓴 경험과 Git의 장점이라고 느낀 점에 대해서 발표했었습니다.

버전관리를 거의 안 하던 시절

버전관리는 먼 나라의 이야기?

Git에 대해 이야기를 하기 전에 지금까지 어떻게 버전관리를 해왔는지 되돌아보겠습니다. 아마 비슷한 경험을 하시고 공감하실 분들이 많으실 듯합니다.

@tarruda
tarruda / .README.md
Last active September 27, 2021 13:21
Tmux/Vim integration

Some scripts/configurations that greatly improve tmux/vim workflows. The shell scripts target zsh but should be adaptable without much effort for other unix shells.

Features:

  • Transparently move between tmux panes and vim windows
  • Using the shell, open files in one vim instance per project or directory
  • Fully integrated copy/paste between tmux, vim and x11 using simple keybinds(need to install the xclip program)
  • Easily send text to any tmux pane without breaking your edit workflow(needs slimux

'vim-tmux-move.zsh', '.vimrc' and '.tmux.conf' cooperate so you can move transparently between tmux panes and vim windows using ALT + (arrow keys or jkhl). It was based on this gist

@saschanaz
saschanaz / installFirefox.cmd
Last active August 29, 2015 14:02
Install Firefox
set directory=%USERPROFILE%
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe"
if errorlevel 1 (
bitsadmin /transfer "DownloadFirefox" "https://download.mozilla.org/?product=firefox-stub&os=win&lang=ko" "%directory%\firefoxInstaller.exe"
echo Installing Firefox...
start /wait /D "%directory%" firefoxInstaller.exe
del "%directory%\firefoxInstaller.exe"
)
start firefox.exe http://jsfiddle.net/saschanaz/Rxv46/embedded/result/
@mbostock
mbostock / .block
Last active January 14, 2023 04:21
Screen Recording to GIF
license: gpl-3.0
@yous
yous / normalize.rb
Created February 6, 2015 10:55
Normalize file name in Windows
require 'unicode'
Dir.glob('*') do |f|
normalized_f = Unicode::normalize_C(f)
if f != normalized_f
puts "Renaming #{f} to #{normalized_f}"
File.rename(f, normalized_f)
end
end
@rakjin
rakjin / force-push.sh
Last active August 29, 2015 14:19
force-push a dir to a git repo
#!/usr/bin/env sh
if [ -z "$1" ] || [ -z "$2" ]; then
echo " WARN: the remote repo will be RESET completely"
echo " usage:"
echo " `basename $0` <DIR_NAME> <REPO_URI>"
echo " `basename $0` files/ https://github.com/your/repo.git"
exit 1
fi
@ruseel
ruseel / aws-docker-high-tracffic-kernel.md
Last active May 24, 2024 14:18
AWS에서 docker를 쓸 때 high traffic server라면 이렇게

AWS에서 docker를 쓸 때 high traffic server라면 이렇게 하는 것이 좋겠다. amazon linux를 쓴다고 하자.

ulimit

ulimit를 올려주어야 한다. /etc/security/limit.conf 에서 고쳐주어도 docker에는 적용되지 않는다. limit.conf는 PAM을 통해서 로그인했을 때만 먹는 설정이라 그렇다. docker로 띄운 process의 pid를 찾고 cat /proc/<pid>/limits를 실행해서 보면 적용되었는지 아닌지 확실하게 알 수 있다. kernel에서 직접 그 프로세스에 어떤 ulimit이 적용되었는지 확인하는 방법이다.

그래서 /etc/sysconfig/docker 파일을 만들고 아래를 추가한다.

@lornajane
lornajane / mac.md
Last active July 6, 2024 02:26
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@codehacken
codehacken / sliding_window.py
Last active June 19, 2024 21:11
Create a Sliding Window function using NumPy.
# Create a function to reshape a ndarray using a sliding window.
# NOTE: The function uses numpy's internat as_strided function because looping in python is slow in comparison.
# Adopted from http://www.rigtorp.se/2011/01/01/rolling-statistics-numpy.html
import numpy as np
# Reshape a numpy array 'a' of shape (n, x) to form shape((n - window_size), window_size, x))
def rolling_window(a, window, step_size):
shape = a.shape[:-1] + (a.shape[-1] - window + 1 - step_size + 1, window)
strides = a.strides + (a.strides[-1] * step_size,)