This file contains 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
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <search.h> | |
#define ARRAY_SZ (10965116) | |
#if 0 | |
void *__real_malloc (size_t); |
This file contains 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<stdlib.h> | |
#define N 10L | |
#define GET_VALUE(i, j, k, l) (N * N * N * i + N * N * j + N * k + l) | |
#ifndef MIN | |
#define MIN(a,b) ((a) < (b) ? (a) : (b)) | |
#endif | |
int quad_array[N][N][N][N]; |
This file contains 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 | |
VERSION=`bash --version|egrep -o "[0-9].[0-9].[0-9]+"` | |
echo "current bash version $VERSION" | |
VER="${VERSION%.*}" | |
echo "bash major version $VER" | |
PATCHLVL="${VER//.}" | |
echo "patch level $PATCHLVL" | |
echo "downloading bash source code" |
This file contains 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 | |
#usage: | |
# $source setclocks.sh | |
# $setxxfreq .. | |
#set -x | |
function setcpufreq() | |
{ | |
if [ -z $1 ]; then | |
echo "usage:setcpufreq <CPUFREQ in kHz>|max [ONLINECPUS](default 4)" | |
echo "e.g: setcpufreq max or setcpufreq max 2" |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
#define BITS_PER_LONG (sizeof(long) * 8) | |
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) | |
#define OFF(x) ((x)%BITS_PER_LONG) | |
#define BIT(x) (1UL<<OFF(x)) | |
#define LONG(x) ((x)/BITS_PER_LONG) | |
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) | |
#define FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
def maxsum(arr): | |
# maxsum, start, end: | |
result = [arr[0], 0, 0] | |
curr = [0, 0, 0] | |
for i in range(0, len(arr)): |
This file contains 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
def check_string(s): | |
mstack = [] | |
bFind = False | |
matches = {')': '(', '}': '{', ']': '['} | |
for c in s: | |
if c in matches.values(): | |
bFind = True | |
mstack.append(c) | |
elif c in matches.keys(): | |
if len(mstack) == 0 or mstack[-1] != matches[c]: |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import BaseHTTPServer | |
import SimpleHTTPServer | |
import argparse | |
import socket | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-b', action='store', dest='host', |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
def happy_number(val): | |
nums = [] | |
nums.append(val) | |
while True: |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
class FSO(object): | |
import win32com.client as com | |
import pywintypes |
OlderNewer