Skip to content

Instantly share code, notes, and snippets.

View Ulu2005's full-sized avatar

Kowa Ulu2005

View GitHub Profile
@Ulu2005
Ulu2005 / app.py
Created November 25, 2012 08:50
A little case of using wxPython with matplotlib
# -*- coding: utf-8 -*-
import os
import wx
from scipy import interpolate
import numpy as np
import matplotlib.pyplot as plt
class MainFrame ( wx.Frame ):
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@Ulu2005
Ulu2005 / gist:4238410
Created December 8, 2012 03:09
Engineering Thermaldynamics

#工程热力学第9章——气体动力循环笔记

这一章主要讲活塞式内燃机和燃气轮机的燃烧循环,通过合理的简化,得到易于分析却又具备参考价值的理想循环。

##核心概念

###性能参数类

  • 循环净功 = 吸热量 - 放热量
  • 循环热效率 = 净功 / 吸收热 = 1 - (放热量 / 吸热量)
  • 相对内效率

Bomb Lab necessities

The bomb lab is most easily completed if you understand the following tools and commands. Also, if I am describing a program, assume that you run it from command line.

Strings

In case you have never used strings before it basically just tells you all the strings in an executable. If I were to run it on the bomb I would simply run

@Ulu2005
Ulu2005 / fsmouse.cpp
Last active August 29, 2015 14:06
soji fsopengl lib mouse func usage
#include "fssimplewindow.h"
#include <stdio.h>
#include <stdlib.h>
typedef struct cursor *PtrCursor;
struct cursor
{
int lb, mb, rb, mx, my;
};
@Ulu2005
Ulu2005 / csapp.c
Last active August 29, 2015 14:07
csapp
/*
* csapp.c - Functions for the CS:APP3e book
*
* Updated 10/2014 droh:
* - Added safe_printf, anasync-signal-safe wrapper for printf
*
* Updated 8/2014 droh:
* - New versions of open_clientfd and open_listenfd are reentrant and
* protocol independent.
*
@Ulu2005
Ulu2005 / vi cheat sheet.md
Created October 7, 2014 20:07
Vi Cheat Sheet

Cursor movement

h - move left
j - move down
k - move up
l - move right
w - jump by start of words (punctuation considered words)
W - jump by words (spaces separate words)

e - jump to end of words (punctuation considered words)

/*
* csapp.h - prototypes and definitions for the CS:APP3e book
*/
/* $begin csapp.h */
#ifndef __CSAPP_H__
#define __CSAPP_H__
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
/*
* waitfg - Block until process pid is no longer the foreground process
*/
void waitfg(pid_t pid) {
sigset_t mask, nomask, old;
struct job_t *j = getjobpid(jobs, pid);
sigfillset (&mask);
sigemptyset (&nomask);
sigprocmask (SIG_SETMASK, &mask, &old);