This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print(int val, int base) { | |
int i; | |
char output[100]; | |
for(i = 0 ;val != 0; i++, val /= base) | |
val%base < 9?(output[i]=(char)(val%base+'0')):(output[i]=(char)(val%base+'A'-10)); | |
for(;i >= 0 ;i--) | |
printf("%c",output[i]); | |
printf("\n"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print(int val, int base) { | |
int p = 0, i, out[1000]; //out: 儲存結果的陣列, p: 計算位數 | |
for ( ; val > 0; val /= base ) { //以 ascii code 將val % base 儲存在out內 | |
out[p++] = val % base > 9 ? val % base + 55 : val % base + 48 ; | |
for ( i = p - 1; i >= 0; i-- ) //從後面開始將每個字元印出來 | |
printf("%c", out[i]); | |
printf("\n"); | |
} | |
int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int match(int x, char s[]) { | |
int i = strlen(s)-1; | |
for ( ; i >= 0; i-- ) { | |
if ( s[i] == '?' ) { | |
x /= 10; | |
continue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "install scudcloud ( slack ubuntu client ) and change icon to slack" | |
sudo apt-add-repository -y ppa:rael-gc/scudcloud | |
sudo apt-get update | |
sudo apt-get install scudcloud | |
wget http://iosicongallery.com/iosicongallery/img/128/slack-2014.png -O ~/scudcloud.png | |
sudo dpkg-divert --add --rename --divert /opt/scudcloud/resources/scudcloud.png.real /opt/scudcloud/resources/scudcloud.png | |
sudo cp ~/scudcloud.png /opt/scudcloud/resources/ | |
sudo chmod +r /opt/scudcloud/resources/scudcloud.png | |
rm ~/scudcloud.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" au BufRead,BufNewFile *.js set filetype=javascript | |
" Note: Skip initialization for vim-tiny or vim-small. | |
if 0 | endif | |
if has('vim_starting') | |
if &compatible | |
set nocompatible " Be iMproved | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --name=acdb -d -p 3306:3306 --env MYSQL_ROOT_PASSWORD=root mysql/mysql-server:5.7 | |
CREATE USER 'ac'@'%' IDENTIFIED BY 'ac'; | |
GRANT ALL PRIVILEGES ON * . * TO 'ac'@'%'; | |
FLUSH PRIVILEGES; |
OlderNewer