Skip to content

Instantly share code, notes, and snippets.

# Define the total production capacity function
def calculate_total_production(a, b, c, ex, ez):
# Calculate X, Y, Z
work_speed = 155 # 75+50+30
work_speed_nocturnal = 175 # 75+50+30+20
X = work_speed * 10 * a + work_speed_nocturnal * 5 * ex + work_speed * 3
Y = work_speed * 10 * b
Z = work_speed_nocturnal * (10 * c + 3 * ez)
@pcyu16
pcyu16 / mem_dump.py
Created May 21, 2019 02:04 — forked from savanovich/mem_dump.py
Memory Dump with Python
# http://lwn.net/Articles/655992/
# https://github.com/mfleming/bits/blob/master/python/bits/__init__.py
import bits
from ctypes import *
mem = (c_char * 128).from_address(0xf1390)
print bits.dumpmem(mem)
# 00000000: 2f 68 6f 6d 65 2f 6a 6f 73 68 ... /home/josh...
@pcyu16
pcyu16 / Makefile
Last active December 18, 2015 17:49
Simple example for multiple file compilation in C
# File: Makefile
# Description: Makefile for building the example
# Author: pcyu16
CC=gcc
OBJS=main.o foo.o
CFLAGS=-Wall -Wextra
all: program
@pcyu16
pcyu16 / set_operation.c
Last active December 12, 2015 02:58
set operation
/**
* set_operation.c
* Author: pcyu16
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stddef.h>
typedef int val_t;
@pcyu16
pcyu16 / systest2.c
Created May 18, 2012 09:02
system function test 2
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
#ifdef WIN32
system("pause");
#endif
@pcyu16
pcyu16 / systest.c
Created May 18, 2012 08:59
system function test 1
#include <stdio.h>
#include <stdib.h>
int main(void)
{
system("pause");
return 0;
}
@pcyu16
pcyu16 / style.css
Created September 14, 2011 20:18
plurk css style
#toggle_tab li:nth-child(3)
{
display : none;
}
@pcyu16
pcyu16 / graph
Created August 23, 2011 08:01
edges/clusters connections
digraph G {
compound=true;
subgraph cluster0 {
a -> b;
a -> c;
b -> d;
c -> d;
}
subgraph cluster1 {
e -> g;
@pcyu16
pcyu16 / myString.cpp
Created July 18, 2011 11:12
implicit constructor
#include <iostream>
#include <string>
using namespace std;
class myString{
private:
string data;
public:
myString(const string& s): data(s)
@pcyu16
pcyu16 / temp.cpp
Created July 16, 2011 07:35
template class/function
#include <iostream>
using namespace std;
template<class T> class Coor;
template<class T>
ostream& operator<< (ostream& out, const Coor<T>& obj);
template<typename T>