Skip to content

Instantly share code, notes, and snippets.

View Staler2019's full-sized avatar

JiaJyun Yang Staler2019

  • 漢昕科技
  • Taichung, Taiwan
  • 21:57 (UTC +08:00)
  • LinkedIn in/jiajyun-yang
View GitHub Profile
@Staler2019
Staler2019 / cerr2file.cpp
Last active November 7, 2022 13:41 — forked from AndreLouisCaron/gist:1841061
C++ std::cerr redirect to file.
#define __TEST__
#ifdef __TEST__
#include <sstream>
// redirect outputs to another output stream.
class redirect_outputs {
std::ostream &myStream;
std::streambuf *const myBuffer;
@Staler2019
Staler2019 / logicTest
Created January 13, 2022 06:15
robot design - final project: software simulation
#include <bits/stdc++.h>
using namespace std;
int x0, start, mv, action, getBall, throwInit, throwBall;
char command;
void init()
{
x0 = 1;
#include "DHT.h"
#include "mbed.h"
using namespace std;
#define NEED_LIGHT_HOURS 12
#define MINUTE_CYCLE 30
// sensor port
DHT dht(PC_13, DHT22); // PC13 = D2
AnalogIn in(PA_5);
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
# print(packages)
call("pip install --upgrade " + ' '.join(packages), shell=True)
# + " --use-feature=2020-resolver" is not the origin this code
1. Virtual Machine Platform
2. Windows Subsystem for Linux
@Staler2019
Staler2019 / template.cpp
Last active June 30, 2022 06:54
Competitive code template
/**
* @file template.cpp
* @author Staler2019 (github.com)
* @brief Competitive code template
* @version 2
* @date 2022-06-30
*
* @copyright Copyright (c) 2022
*/
@Staler2019
Staler2019 / alg-HW8E_dfs.cpp
Last active May 11, 2021 05:33
using no-constraint dfs to solve 8-puzzle problem
#include <iostream>
using namespace std;
int arr[3][3] = {{2, 0, 3}, {1, 8, 4}, {7, 6, 5}};
void printArr()
{
for (int j = 0; j < 3; j++)
{
cout << "-------" << endl;
#!/bin/bash
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get clean
sudo apt-get -y autoremove