Skip to content

Instantly share code, notes, and snippets.

@float-tw
float-tw / .screenrc
Created May 10, 2015 16:50
screenrc
# 關閉啟動訊息。
startup_message off
# 加入狀態列。
caption always "%{=u .r} %-w%<%{=ub .Y}%n %t%{=u .r}%+w "
hardstatus alwaysignore
hardstatus alwayslastline "%{= .K} [%l]%<%=%{= .Y}$USER%{= .R}@%H %=%{= .m} %Y/%m/%d%{= .M} %0c "
# 將預設編碼設為 UTF-8。
defutf8 on
x = 1
for i in range(1, 101):
x = x * i
print x
# OUT: 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
#or
import math
#!/bin/bash
passwd_name=test.passwd
home_root=/tmp
touch $home_root/$passwd_name
while read user_info
do
name=$(echo $user_info | awk '{print $1}')
<!-- $Id: summary.xsl 1958 2009-11-16 03:28:50Z boudreat $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator="," />
<xsl:template match="contestStandings">
<html>
<head>
<title>
計分板 - <xsl:value-of select="/contestStandings/standingsHeader/@title"/>
</title>
@float-tw
float-tw / bashrc
Created August 19, 2012 07:51
bashrc note
# two line prompt (show git branch)
PS1='\n\[\033[01;30m\]┌[\[\033[00m\]'
PS1+='${debian_chroot:+($debian_chroot)}'
PS1+='\[\033[01;32m\]\u\[\033[00m\]@\h'
PS1+='\[\033[01;30m\]]\[\033[00m\]:'
PS1+='\[\033[01;33m\]\w\[\033[00m\]'
PS1+='\[\033[01;34m\]$(__git_ps1)\[\033[00m\]'
PS1+='\n\[\033[01;30m\]└─\[\033[00m\]\$ '
# For colourful man pages (CLUG-Wiki style)
@float-tw
float-tw / chroot.sh
Created August 13, 2012 11:05
chroot setup
#! /bin/sh
chroot_bin="/tmp/chroot/bin/"
chroot_lib="/tmp/chroot/lib/"
cmd_list="/bin/bash \
/bin/ls \
/bin/cp \
/bin/mkdir \
/bin/mv \
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import sys
from random import Random
if( len(sys.argv) > 1 ):
passwd_len = int(sys.argv[1])
else:
@float-tw
float-tw / string_split.cpp
Created May 30, 2012 16:35
c++ string split
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void split(string source, string delim, vector<string>& result)
{
string tmp;
size_t now=-1, next=-1;
@float-tw
float-tw / gist:1477860
Created December 14, 2011 18:35
用p代替滑鼠左鍵(windows)
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int chk;
while(1)
{
Sleep(1);