Skip to content

Instantly share code, notes, and snippets.

@lenciel
lenciel / ssh-copy-id
Last active December 15, 2015 17:39
Get ssh-copy-id on Mac OS X
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
#
# http://www.devthought.com/2009/09/19/get-ssh-copy-id-in-mac-os-x/
#
@lenciel
lenciel / Android截屏
Last active December 22, 2015 15:29
Android如何命令行进行截屏
一般 Android 用户都知道同时按下音量减和电源键的屏幕截图方式,不过作为开发者,可能需要一个更为简便的方式将屏幕截图保存至开发电脑上。
该方式仅需在终端执行一条命令即可,涉及调用系统内置的 screencap 工具:
```
adb shell screencap -p | sed 's/\r$//' > screen.png
```
screencap 本身支持标准输出,所以可以用管道符链接。但是 adb shell 会将结果中的 LF 转换为 CR+LF(为了兼容性考虑?),于是会将 png 的格式破坏。于是这里使用行编辑器 sed 将 LF 前的 CR 移除。
@lenciel
lenciel / vertical align
Created January 15, 2014 18:19
vertical align anything
%vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.element p {
@extend %vertical-align;
@lenciel
lenciel / Useful netcat examples on Linux.md
Last active February 16, 2024 04:12
Useful netcat examples on Linux

Often referred to as the "swiss army of knife" for TCP/IP networking, [Netcat][1] is an extremely versatile Linux utility that allows you to do anything under the sun using TCP/UDP sockets. It is one of the most favorite tools for system admins when they need to do networking related troubleshooting and experimentation.

In this tutorial, I am sharing a few useful netcat examples, although the sky is the limit when it comes to possible netcat use cases. If you are using netcat regularly, feel free to share your use case.

Note that when you are binding to well-known ports (0-1023) with nc, you need root privilege. Otherwise, run nc as a normal user.

1. Test if a particular TCP port of a remote host is open.

$ nc -vn 192.168.233.208 5000

基础知识

  • 计算机软硬件基础
  • 计算机网络
  • 操作系统
  • 数据结构和算法
  • 设计模式
  • 以及其他各种你应该懂的东西

前端开发

  • 前端标准/规范
@lenciel
lenciel / _syntax.diff
Last active August 29, 2015 14:01
diff before and after gist render sass fix
diff --git a/46501e4:sass/partials/_syntax.scss b/02b0441:sass/partials/_syntax.scss
index 137d475..5465286 100644
--- a/46501e4:sass/partials/_syntax.scss
+++ b/02b0441:sass/partials/_syntax.scss
@@ -22,10 +22,6 @@
@include border-radius(0);
}
-.line-data {
- font-size: 13px;
@lenciel
lenciel / autossh.lenciel.plist
Last active December 6, 2022 07:59
autossh plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>autossh.lenciel</string>
<key>ProgramArguments</key>
<array>
@lenciel
lenciel / sentry.conf.py
Created September 4, 2014 14:37
sentry configuration file
# This is the configuration file for sentry used by lenciel@gmail.com.
# It's actually nothing special but a django settings file so you may put items like "ALLOWED_HOSTS" in it.
from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
@lenciel
lenciel / supervisord
Created September 4, 2014 14:41
/etc/init.d/ script for supervisor on ubuntu
#! /bin/sh
# Makre sure you have the correct path set for:
# DAEMON=/usr/local/bin/supervisord
# SUPERVISORCTL=/usr/local/bin/supervisorctl
#
#
### BEGIN INIT INFO
# Provides: supervisor
# Required-Start: $remote_fs $network $named
@lenciel
lenciel / supervisord.conf
Created September 4, 2014 16:03
supervisor configuration file for sentry
;Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
;
; Put this file in /etc/supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)