Skip to content

Instantly share code, notes, and snippets.

Quinn Sheng a1exlism

Block or report user

Report or block a1exlism

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View symbols
SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] ^_`abcdefghijklmnopqrstuvwxyz{|}~"""
@a1exlism
a1exlism / Run_commands_standalone.sh
Created Oct 9, 2019
[Run_commands_standalone] #bash
View Run_commands_standalone.sh
nohup `CMD` &
# Link:
# https://unix.stackexchange.com/questions/4004/how-can-i-run-a-command-which-will-survive-terminal-close
View large_file_read.py
# LINK https://segmentfault.com/a/1190000005356779
#!/usr/bin/env python
# coding=utf-8
import sys
import time
start = time.time()
lines = 0
for each_line in sys.stdin:
View ES6_Assign at once.js
class Test {
constructor() {
this.data = {
name: null,
age: -1,
attr: null
}
}
init() {
this.data = {
View java_exceptions.java
public class ThrowException {
public static void main(String args[]) {
try {
process1();
} catch (Exception e) {
e.printStackTrace();
}
}
static void process1() {
View random_numbers.cpp
/*
* 生成在[a, b]范围内的随机数据
* Random numbers in the range of [a,b]
*/
#include <cstdio>
#include <cstdlib>
#include <ctime>
const int MAXN = 1000;
int main() {
int arr[MAXN];
View binary_sarch.cpp
/*
* INPUT: 100 \n
* TIPS: 输入必须有序, 否则pos无意义
* 1 10 11 11 12 12 13 15 16 18 2 2 20 20 20 20 21 21 21 22 22 22 23 23 23 23 24 24 24 24 24 27 27 28 32 35 4 40 40 40 41 42 44 44 46 47 47 5 5 52 53 54 57 58 6 60 61 62 62 63 63 64 65 65 65 69 7 70 70 71 71 72 75 75 76 77 8 8 82 84 84 85 86 86 87 89 9 9 91 91 93 93 95 95 96 97 97 98 98 99
* Search X \n
* OUTPUT: position of X
*/
#include <cstdio>
#include <algorithm>
using namespace std;
View shell_ln_symbol_attention.shell
# ln -s Refer
# http://mrhopehub.github.io/2014/04/27/ln.html
# 1. Recommand | use both ABSOLUTE path when using ln -s command
ln -s /absolute/path/source /absolute/path/output
# 2. Relative directory | source`$1` is relative the output path`$2`
ln -s /relative/to/output(which is `SOURCE`) /absolute/path/output
# NOT Recommand | More specific example: ln /tmp/dir1/source TO /tmp/dir2/output
View innderHTMLCode.php
<?php
print <<<EOT
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
View shell_dirctor.sh
# Link: https://unix.stackexchange.com/questions/77007/mv-cannot-stat-no-such-file-or-directory-in-shell-script
# Failed
mv /path/to/FILE /new/path/to/FILE
# Double Quote the directory
mv "/path/to/"FILE "/new/path/to/"FILE
You can’t perform that action at this time.