Skip to content

Instantly share code, notes, and snippets.

View carlcarl's full-sized avatar

Carl Huang carlcarl

View GitHub Profile
@JustinTW
JustinTW / cheatsheets.md
Last active March 31, 2017 01:43
Linux 大量檔案操作 Cheatsheets (最快速的方法蒐集)

產生檔案

產生 1000 個 500kb 的隨機檔案

for i in {1..100000}; do head -c 500 /dev/urandom > dummy$i; done

產生隨機內容大檔案 (1G)

@kilfu0701
kilfu0701 / setValue.go
Created October 7, 2016 06:27
[Golang] Set value into a Struct by string name
// https://play.golang.org/p/DnGeQsaGfi
package main
import (
"fmt"
"reflect"
)
type Ogp struct {
Title string
Nginx使用者請看這
由於Let's Encrypt的安裝程式目前還沒有提供nginx模組(其實有在開發,只是還在測試階段),我們依舊可以透過安裝程式自動取得certification後,手動更新nginx的設定黨即可。
首先,我們先取得免費的憑證:
# 如果nginx正在執行中,請先把它關閉
$ sudo -s
$ service nginx stop
$ ./letsencrypt-auto certonly --email 你的email@你的email.net -d freessl.csie.io
@paulirish
paulirish / what-forces-layout.md
Last active December 8, 2025 09:19
What forces layout/reflow. The comprehensive list.

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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@jaceju
jaceju / xss_notes.md
Last active July 17, 2020 15:08
XSS 上課筆記

XSS 上課筆記

OWASP

  1. Injection
  2. Broken Authentication and Session Management
  3. XSS

Devcore

@legnaleurc
legnaleurc / asyncio.py
Last active November 17, 2018 21:27
Tornado v.s. asyncio (Python 3.5+)
#! /usr/bin/env python3
import asyncio
import contextlib
async def ping(ip):
p = await asyncio.create_subprocess_exec('ping', '-c', '4', ip, stdout=asyncio.subprocess.PIPE)
async for line in p.stdout:
print(line)
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@raimon49
raimon49 / install_tig_on_ubuntu.sh
Created May 2, 2014 11:40
Ubuntu Server 12.04 LTSにTig 最新版(2.0.1)を入れる
# 日本語用
$ sudo apt-get install libncursesw5-dev
# ソースコード取得
$ git clone https://github.com/jonas/tig.git
$ cd tig
$ git checkout -b my-build-2.0.1 tig-2.0.1
# ビルド, インストール
$ LDLIBS=-lncursesw CFLAGS=-I/usr/include/ncursesw make install prefix=$HOME/local
@keis
keis / coro.py
Created April 14, 2014 08:27
asyncio examples
import asyncio
@asyncio.coroutine
def waiting(r):
print("hello from waiting -", r)
yield from asyncio.sleep(2)
print("bye from waiting -", r)
return r
@hozaka
hozaka / float-label-pattern.html
Last active August 29, 2015 13:56
A float label implement with validation by pure css
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>Float Label Pattern</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<style type="text/css" media="screen">
.row {
/*position: relative;*/
padding-top: 24px;