เปิด Terminal แล้วทำตามนี้
$ mkdir -p $HOME/bin
สร้างไฟล์ $HOME/bin/free-mem
$ touch $HOME/bin/free-mem
ใส่โค้ด free-mem.sh ไปใน $HOME/bin/free-mem ให้ copy โค้ด free-mem.sh จะ command + C หรือ คลิกขวา copy ก็ได้ เอาให้ครบ
| import java.util.Random; | |
| public class CountChars { | |
| static char[] chars; | |
| static int[] count; | |
| static String[][] graph; | |
| public static void main(String args[]) { | |
| chars = new char[100]; | |
| count = new int[26]; | |
| rand_char(chars); |
| #!/bin/bash | |
| action=$1 | |
| if [[ "$action" == "update" ]]; then | |
| softwareupdate -lv | |
| elif [[ "$action" == "upgrade" ]]; then | |
| softwareupdate -iva | |
| else | |
| echo "No action for $action" | |
| fi |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| #logs_content { | |
| border: 1px solid red; | |
| width:98%; | |
| height: 480px; | |
| position:relative; |
| #!/bin/bash | |
| if [ $# -eq 0 ]; then | |
| echo "Usage : $ exif /path/to/file" | |
| exit | |
| fi | |
| echo "EXIF of `basename $1`" | |
| identify -format %[exif:*] $1 |
| #!/usr/bin/env luajit | |
| -- author : Narate Ketram | |
| -- github.com/narate | |
| -- $ echo '{"name":"narate"}' | parse_json name | |
| -- "narate" | |
| local cjson = require 'cjson.safe' | |
| local data = io.read('*all') | |
| local json = cjson.decode(data) |
| #!/usr/bin/env luajit | |
| -- author : Narate Ketram | |
| -- github.com/narate | |
| -- usage : | |
| --[[ | |
| echo ' | |
| { | |
| "query": { | |
| "bool": { |
| # -*- coding: utf-8 -*- | |
| import scrapy | |
| from thaischool.items import ThaischoolItem | |
| class SchoolSpider(scrapy.Spider): | |
| name = "school" | |
| allowed_domains = ["thaischool.in.th"] | |
| base_url = 'http://www.thaischool.in.th/sitemap.php?page=%s&school_area=&province_id=&txtsearch=' | |
| start_urls = [] | |
| for i in range(1,236): |
| #!/usr/bin/env python | |
| #-*-coding: utf-8 -*- | |
| from BeautifulSoup import BeautifulSoup | |
| from urlparse import urlparse | |
| import urllib2 | |
| import json | |
| import sys | |
| import re |
| Alive = True | |
| def code(): | |
| print "coding..." | |
| while Alive: | |
| code() | |
| print "I'm happy :)" |