Skip to content

Instantly share code, notes, and snippets.

View chenfengyuan's full-sized avatar

Fengyuan Chen chenfengyuan

View GitHub Profile
。。。快了快了。转自石惠.sally:转自方圆: 转自郭沁沁:@沈聪 Sis 转自杨帆: 转自彪悍的人生不需要解释: 转自美不美先看腿
美不美先看腿 : 上大学这么长时间了 胖了10斤以上的请举手
46分钟前 通过人人桌面发布 分享
《科幻世界》:1942年1月7日,日军偷袭珍珠港的一个月之后,美国军方为了预防日军对美国本土发动化学战,开始制订保护平民的措施。图中便是一款针对儿童推出的米老鼠防毒面具,也可谓是卡通防毒面具的先驱。据说当时选择卡通形象,是考虑到它可以起到安抚儿童的作用。是不是囧中有萌?
26分钟前分享
《科幻世界》发表日志 【书刊讯】2012.07科幻世界上市啦
/*
common lispc产生代码
(loop for j from 1 to 100 do (loop for i from 1 to j for s = 1 then (* i s) finally (format t "\"~,,',,4:d\"," s)))
*/
#include <stdio.h>
int main(void)
{
char *data[]={"1","2","6","24","120","720","5040","4,0320","36,2880","362,8800","3991,6800","4,7900,1600","62,2702,0800","871,7829,1200","1,3076,7436,8000","20,9227,8988,8000","355,6874,2809,6000","6402,3737,0572,8000","12,1645,1004,0883,2000","243,2902,0081,7664,0000","5109,0942,1717,0944,0000","11,2400,0727,7776,0768,0000","258,5201,6738,8849,7664,0000","6204,4840,1733,2394,3936,0000","15,5112,1004,3330,9859,8400,0000","403,2914,6112,6605,6355,8400,0000","1,0888,8694,5041,8352,1607,6800,0000","30,4888,3446,1171,3860,5015,0400,0000","884,1761,9937,3970,1954,5436,1600,0000","2,6525,2859,8121,9105,8636,3084,8000,0000","82,2283,8654,1779,2281,7725,5628,8000,0000","2631,3083,6933,6935,3016,7218,0121,6000,0000","8,6833,1761,8811,8864,9551,8194,4012,8000,0000","295,2327,9903,9604,1408,4761,8609,6435,2000,0000","1,0333,1479,6638,6144,92
#include <iostream>
#include <algorithm>
#include <time.h>
using namespace std;
int main()
{
const int N = 100000000;
const int K = 100;
(in-package :cl)
(declaim (optimize (speed 3)))
(eval-when (:compile-toplevel :load-toplevel :execute)
(dolist (p '(:cl-heap))
(unless (find-package p)
(ql:quickload p))))
(defpackage :find-kth-largest
(:use :cl :cl-heap)
(:nicknames :fkl))
(in-package :find-kth-largest)
(defun split-per-3-lines (directory prefix suffix)
(interactive
(let (d p s)
(setq d (read-directory-name "Directory : "))
(setq p (read-string "prefix : "))
(setq s (read-string "suffix : "))
(list d p s)))
(save-excursion
(goto-char (point-min))
(let ((triplets
-include $(OBJS:.o=.d)
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
$(CC) -MM -MP $(CFLAGS) $*.c > $*.d
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp -o $*.o
$(CXX) -MM -MP $(CXXFLAGS) $*.cpp > $*.d
%.o: %.cc
$(CXX) -c $(CXXFLAGS) $*.cc -o $*.o
@chenfengyuan
chenfengyuan / hanoi_async
Created July 29, 2013 03:32
hanoi_async's written by jackarain cool stuff
#include <iostream>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/lexical_cast.hpp>
#include <stdio.h>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
boost::interprocess::interprocess_mutex mutex_;
void hanoi_async(boost::asio::io_service& io, int n, char A, char B, char C)
// clang++ -std=c++11 -Wall -Wextra -stdlib=libc++ string-swap.cc -o string-swap.out
// ./string-swap.out 'macbook air' air book
// macair book
#include <string>
#include <iostream>
#include <utility>
#include <algorithm>
void string_swap(std::string & str, int s1, int l1, int s2, int l2){
if(s1>s2)
return string_swap(str, s2, l2, s1, l1);
@chenfengyuan
chenfengyuan / test.cc
Last active January 1, 2016 19:29
clang++ -g -std=c++11 -Wall -Wextra -stdlib=libc++ -g -O2 test.cc -o test.out
#include <stdio.h>
#include <stdlib.h>
void base64_encode(size_t slen){
unsigned a;
unsigned i;
unsigned k;
unsigned n;
// char * dst = (char *)malloc(4*sizeof(char));
char * dst = new char(4);
#include <tuple>
#include <memory>
int main(void){
using namespace std;
unique_ptr<char[]> a(new char[3]);
make_tuple(move(a));
}