Skip to content

Instantly share code, notes, and snippets.

View mengjiann's full-sized avatar
🤔
code. code.

MJ mengjiann

🤔
code. code.
  • Illumina
  • Singapore
View GitHub Profile
@mengjiann
mengjiann / gist:c38be8a21377cd002fa6bf5aac8ea3f3
Last active September 24, 2020 03:27
Useful OracleDB Command
/* Sqlplus */
`ORACLE_SID=<SID> ORACLE_HOME=/oracle/CWDB01/product/12.1.0 /oracle/CWDB01/product/12.1.0/bin/sqlplus "sys as SYSDBA"`
/* Setting up directory for using import/export datapump */
CREATE DIRECTORY db_restore AS '<MOUNT FOLDER IN CONTAINER>';
GRANT read, write ON DIRECTORY db_restore TO sys;
GRANT DATAPUMP_EXP_FULL_DATABASE,DATAPUMP_IMP_FULL_DATABASE TO sys;
/* Import using data pump */
expdp \"sys/passwd@localhost/ORCLCDB as sysdba\" full=Y DIRECTORY=db_restore dumpfile=export-db.dmp
@mengjiann
mengjiann / gist:a9140445d41cc05c5b71cb9e8e62028c
Created May 26, 2020 11:57
Upload large file using Apache HttpClient
HttpClientContext clientContext = HttpClientContext.create();
// clientContext.setCredentialsProvider(credentialsProvider);
// clientContext.setAuthCache(authCache);
HttpPost post = new HttpPost(endpointUri);
HttpEntity entity = MultipartEntityBuilder.create()
.addBinaryBody("file", inputStream, ContentType.create("application/octet-stream"), fileName)
.build();
post.setEntity(entity);
# Set recursive in file
svn propset svn:ignore -F svnignore .
# Remove all svnignore command recursively
svn propdel svn:ignore -R .
# Set global ignore in $HOME/.subversion/config
[miscellany]
global-ignores = *.o *.so *.so.[0-9]* .DS_Store [Tt]humbs.db
@mengjiann
mengjiann / gist:5e3346d99a5df280e6858974bd0cb8ed
Created February 16, 2020 05:42
Command Line Shortcuts
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
# Install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Software from Brew
- switchaudio-osx
- springboot
- maven
# Install Software from Brew Cask
- iterm2
@mengjiann
mengjiann / gist:c65e207ae14180de7d2a258db61dc7e3
Created February 10, 2020 01:11
Spring Boot FTP Integration Sample Code
@Slf4j
@SpringBootApplication
public class FtpDemoApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplicationBuilder()
.sources(FtpDemoApplication.class).web(WebApplicationType.NONE).build();
springApplication.run(args).close();
}
@mengjiann
mengjiann / gist:8a3bc7bcb0f6f35264c3e6ebce75cd79
Created December 4, 2019 02:57
Prepare the docker image for the SpringBoot app to connect to MySQL using SSL
FROM openjdk:8-jdk
# For alpine
# RUN apk add --update openssl
# RUN apk add coreutils
# create a temp dir in which to work
RUN OLDDIR="$PWD"
RUN mkdir /tmp/rds-ca && cd /tmp/rds-ca
@RunWith(SpringRunner.class)
@WebMvcTest(EntrySubmitRestController.class)
@ContextConfiguration(classes = EntrySubmitRestControllerTest.ContextConfiguration.class)
public class EntrySubmitRestControllerTest {
@TestConfiguration
static class ContextConfiguration {
@Bean
@Qualifier("entrySubmitDueDate")
https://github.com/mroth/scmpuff
@mengjiann
mengjiann / gist:ed7de455598640800e01fbd3c99c7250
Created May 23, 2019 05:55
Dockerfile for awscli with K8S deployment
FROM python:2.7
ENV AWS_DEFAULT_REGION='[your region]'
ENV AWS_ACCESS_KEY_ID='[your access key id]'
ENV AWS_SECRET_ACCESS_KEY='[your secret]'
RUN pip install awscli
CMD /bin/bash