This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### AUTOMATIC TUNNEL WITH CLOUDFLARE SCRIPT #### | |
jupyterhub & cloudflared tunnel --url http://localhost:8000 | |
code-server --auth=none -p 8001 & cloudflared tunnel --url http://localhost:8001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function loadFile(){ | |
mysql -u"[USERNAME]" -p"[USERNAME]" --local-infile=1 [DATABASE_NAME] << EOF | |
SET GLOBAL local_infile = 'ON'; | |
LOAD DATA LOCAL INFILE "$1" INTO TABLE $2 | |
COLUMNS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '"' | |
LINES TERMINATED BY '\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from __future__ import unicode_literals | |
import os | |
import io | |
import time | |
import requests | |
import argparse | |
import zipfile | |
__author__ = 'John Beieler, johnbeieler.org' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from threading import Thread | |
import time | |
port_number = "8000" | |
def run_on(port): | |
os.system("python -m http.server " + port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Extract categorical feature and numerical feature | |
def extract_factor_numeric(data:pd.DataFrame, list_a:list): | |
numeric = [] | |
factor = [] | |
for i in range(0, len(list_a)): | |
if len(Counter(data['{}'.format(list_a[i])])) >= 20: # or other threholds | |
numeric.append(list_a[i]) | |
else: | |
factor.append(list_a[i]) | |
return numeric, factor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
typedef struct { | |
const char *name; | |
int rank; | |
double expect_rate; | |
} girl; | |
const int K = 10; | |
void read_girl(girl g) { | |
printf("Girl name: %s, rank: %d, expect_rate: %.5f\n",g.name,g.rank,g.expect_rate); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub BatchCopy() | |
Application.ScreenUpdating = False 'turnoff screen refresh | |
For i = 5 To 2 Step -1 | |
For n = 1 To 3 | |
Rows(i & ":" & i).Select | |
Selection.Copy | |
Selection.Insert Shift:=xlDown | |
Next n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Author: Terence Liu | |
## Date: 2020-02-05 | |
## Follow: CC0 | |
require(jsonlite) | |
require(ggplot2) | |
require(maptools) | |
require(maps) | |
require(mapdata) | |
library(devtools) # install.packages("devtools", dep = T, repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
basepath=$(cd `dirname $0`; pwd) | |
cat $basepath/name.txt | while read line | |
#eampty the user.txt | |
#echo /dev/null > echo basepath/user.txt | |
do | |
echo "The user name is : ${line}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################### | |
# Question:(solved) | |
# Given an array S of n integers, are there elements a, b, c in S | |
# such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. | |
# Input: [-1, 0, 1, 2, -1, -4] | |
# Output: [[-1, 0, 1], [-1, -1, 2]] | |
# Answerer:Terence Liu | |
################################### | |