Skip to content

Instantly share code, notes, and snippets.

View mengcz13's full-sized avatar
💭
I may be slow to respond.

Chuizheng Meng mengcz13

💭
I may be slow to respond.
View GitHub Profile
@mengcz13
mengcz13 / sync04_barber.c
Created May 6, 2017 15:20
Solution for barber problem~
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define N 10
#define TN 3
#define MAX_WTIME 5
@mengcz13
mengcz13 / disksim-homework.py
Created May 12, 2017 08:25
CLOOK, funtion: Disk.DoCLOOK(self, rList)
#! /usr/bin/env python
from Tkinter import *
from types import *
import math, random, time, sys, os
from optparse import OptionParser
from decimal import *
MAXTRACKS = 1000
@mengcz13
mengcz13 / test_pytorch_grad.ipynb
Created December 4, 2019 20:41
Test PyTorch grad function
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mengcz13
mengcz13 / train_utils.py
Last active March 5, 2020 01:44
some util functions for pytorch, including checkpoint saving and loading
import os
import sys
import socket
import time
import argparse
import pickle
import datetime
import multiprocessing
@mengcz13
mengcz13 / csci103_lab3_checkoff_script.sh
Created September 15, 2021 22:46
csci103_lab3_checkoff_script
printf '0 10 10 20 20\n0 25 50 1 150\n1 128 128 50 50\n1 200 200 15 30\n2' | ./shapes
mv output.bmp output_1.bmp
printf '0 30 -30 60 60\n0 -30 30 60 60\n0 240 30 60 60\n0 30 240 60 60\n2' | ./shapes
mv output.bmp output_2.bmp
printf '1 30 -30 120 120\n1 -30 30 120 120\n1 240 30 120 120\n1 30 240 120 120\n1 100 100 20 50\n2' | ./shapes
mv output.bmp output_3.bmp
@mengcz13
mengcz13 / cs103l_fall21_lab5test.sh
Last active October 19, 2021 23:18
cs103l_fall21_lab5test
COLOR='\033[0;32m'
NC='\033[0m' # No Color
printf '6\ncs103 trojan\nmidterm\naced\nperfect\nscore\n' > wordbank.txt
echo -e "${COLOR}-----use the provided wordbank file, allowing demo of correct guess (30 points)-----${NC}"
sed -i "s/int target = rand() % numWords;/int target = numWords - 1;/" scramble.cpp
g++ scramble.cpp -o scramble
./scramble wordbank.txt <<< "score"
echo ""