Skip to content

Instantly share code, notes, and snippets.

View Dup4's full-sized avatar

Duplicate4 Dup4

View GitHub Profile
@Dup4
Dup4 / cpp.py
Created October 24, 2023 00:50
Python3 <-> C++
#include <iostream>/*
"""*/
using namespace std;//""""""
/*"""
class ostream:
def __lshift__(self,a):
print(a,end="")
return self
cout=ostream()
endl="\n"
@Dup4
Dup4 / 中文编程.cpp
Last active October 7, 2023 05:03
中文 C++ 编程
#include <iostream>
using namespace std;
#define 输出 cout
#define 换行 endl
#define 常量 const
#define 整形 int
#define 等于 =
#define 主函数 main
#define 返回 return
@Dup4
Dup4 / doc-table.md
Created May 25, 2022 05:21 — forked from antfu/doc-table.md
Doc Table in Markdown

Example

Name

Description


@Dup4
Dup4 / get_git_commit_id.sh
Last active February 24, 2022 02:07
get git commit id
#! /bin/bash
GIT_COMMIT="Unknown"
if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
GIT_COMMIT=$(git rev-parse --short HEAD)
fi
echo "${GIT_COMMIT}"
@Dup4
Dup4 / run_full_cpu.sh
Last active December 30, 2021 15:56
Run full cpu
# This line of command has no side effects.
for i in `seq 1 $(cat /proc/cpuinfo |grep "physical id" |wc -l)`; do dd if=/dev/zero of=/dev/null & done
# if you want to stop, please kill them
pkill -9 dd
@Dup4
Dup4 / get_cpp_version.sh
Last active December 30, 2021 15:43
get g++ default cpp version
g++ -dM -E -x c++ /dev/null | grep -F __cplusplus
@Dup4
Dup4 / gist:1459f64faaebe901dbe6ed5267b5fc32
Last active May 29, 2021 01:23
Install Node Env In Ubuntu
wget -qO- https://deb.nodesource.com/setup_14.x | sudo -E bash -
## Run `sudo apt-get install -y nodejs` to install Node.js 14.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
@Dup4
Dup4 / randomPassword.js
Last active December 30, 2021 15:43
Random Password
// Random user password
function randomPassword(length) {
length = Number(length)
// Limit length
if (length < 6) {
length = 6
} else if (length > 16) {
length = 16
}
let passwordArray = ['ABCDEFGHJKLMNPQRSTUVWXYZ', 'ABCDEFGHJKLMNPQRSTUVWXYZ', '23456789', '!@#$%&*()'];
@Dup4
Dup4 / .vimrc
Created January 5, 2021 04:43
My vim configuration file
set nu!
set backspace=2
set tabstop=4
set clipboard=unnamed
set smarttab
set shiftwidth=4
set cin
set mouse=a
syntax on
@Dup4
Dup4 / polygon_format_tests.py
Last active December 23, 2020 08:20
polygon_format_tests.py
import os
for file in os.listdir('tests'):
filename = file.split('.')[0]
ext = file.split('.')[-1]
new_ext = ''
if ext == 'a':
new_ext = 'out'
else:
new_ext = 'in'