Skip to content

Instantly share code, notes, and snippets.

View jingning42's full-sized avatar

Jingning Zhang jingning42

View GitHub Profile
@jingning42
jingning42 / Project_Euler.py
Created September 24, 2014 13:23
Project Euler#1
my_list = []
now_list = range(1,1000)
for i in range(1,1000):
if i%3 == 0:
my_list.append(i)
now_list.remove(i)
for j in now_list:
if j%5 == 0:
my_list.append(j)
@jingning42
jingning42 / Project_Euler.c
Created September 28, 2014 01:08
Project_Euler#1.c
#include <stdio.h>
int main() {
int sum = 0, num;
for (num = 0; num < 1000; num ++){
if (num % 3 == 0 || num % 5 == 0){
sum = sum + num;
}
}
printf("sum = %d",sum);
@jingning42
jingning42 / #2fib
Last active August 29, 2015 14:06 — forked from cuihaoleo/fib
def fib (m):
a, b, c = 0, 1, 1
yield 1
while a+b <= m:
c = a + b
yield c
a, b= b, c
s = 0
for i in fib(4000000):
#include <stdio.h>
int main()
{
int sum = 2;
int a = 1, b = 1, c = a + b;
while (c < 4000000)
{
a = b, b = c, c = a + b;
if (c % 2 == 0)
@jingning42
jingning42 / fib_C.c
Last active August 29, 2015 14:06 — forked from cuihaoleo/fib_C.c
#include <stdio.h>
int main ()
{
int a = 0, b = 1, c = 1, sum = 0;
while (c < 4000000)
{
if (c % 2 == 0)
sum += c;
@jingning42
jingning42 / a.py
Last active August 29, 2015 14:07 — forked from cuihaoleo/a.py
#!/usr/bin/env python3
import re
import sys
prog = re.compile(r"\\N(?:{[^{}]*})?")
prog2 = re.compile(r"(Dialogue: \w*,\w*:\w*:\w*.\w*,\w*:\w*:\w*.\w*,\w*,\w*,\w*,\w*,\w*,\w*,)(.*)")
for line in sys.stdin:
**************************************
* command: sudo smartctl -a /dev/sda *
**************************************
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-43-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Momentus SpinPoint M8 (AF)
Device Model: ST1000LM024 HN-M101MBB