Skip to content

Instantly share code, notes, and snippets.

:octocat:
Focusing

chenrui chenrui333

:octocat:
Focusing
Block or report user

Report or block chenrui333

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
@chenrui333
chenrui333 / printFilelist_py27
Last active Aug 29, 2015
printout the files with subdirectory
View printFilelist_py27
import os
filepath_root1 = "C:\\Users\\rchen\\directory"
file_to_write = "./samplefile.txt"
with open(file_to_write, "w") as myfile:
for path, subdirs, files in os.walk(filepath_root1):
for name in files:
path = path.replace(filepath_root1, "")
myfile.write(os.path.join(path, name) + "\n")
@chenrui333
chenrui333 / findColumnInfo
Created Aug 6, 2014
SQLServer find the table and column info
View findColumnInfo
select TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE
from Information_schema.columns
where Table_name in (
SELECT name
AS SchemaTable
FROM sys.tables
)
@chenrui333
chenrui333 / FindKeyRelationships
Created Aug 6, 2014
Find the Foreign Key Associated with a Given Primary Key
View FindKeyRelationships
SELECT
o1.name AS FK_table,
c1.name AS FK_column,
fk.name AS FK_name,
o2.name AS PK_table,
c2.name AS PK_column,
pk.name AS PK_name,
fk.delete_referential_action_desc AS Delete_Action,
fk.update_referential_action_desc AS Update_Action
FROM sys.objects o1
@chenrui333
chenrui333 / GeneratePojo.py
Created Aug 29, 2014
Generate Pojo with SQL server auto-gen table creation SQL code
View GeneratePojo.py
import re
import fileinput
def camelCase(st):
"""
filter nonAlpha and nonDigit char, and camelCase the output string
input:
USER_DEF1
output:
userDef1
View stackoverflow-28245950
## Test Class, JdbcTest.java
package test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
@chenrui333
chenrui333 / JsonParser
Last active Aug 29, 2015
Jackson-Json
View JsonParser
## Jackson dependencies
jackson-databind
jackson-annotations
jackson-core
##
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
##
@chenrui333
chenrui333 / rename.py
Created Feb 25, 2015
rename the file names in the dir list
View rename.py
# Import the os module, for the os.walk function
import os
# Set the directory you want to start from
dirs = ['dir1', 'dir2']
prefix = 'abc'
suffix = '_abc'
for dir in dirs:
for dirName, subdirList, fileList in os.walk(dir):
print('Found directory: %s' % dirName)
View find_LDAP_server_version
ldapsearch -H ldaps://xxx.harvard.edu:3131 -s base -D "cn=xxx" "(objectclass=*)" vendorversion objectClass isGlobalCatalogReady vendorname
# extended LDIF
#
# LDAPv3
# base <> (default) with scope baseObject
# filter: (objectclass=*)
# requesting: vendorversion objectClass isGlobalCatalogReady vendorname
#
#
@chenrui333
chenrui333 / interview_questions
Last active Jul 6, 2016
Interview questions hub
View interview_questions
Full-stack
https://github.com/indy256/Full-stack-Developer-Interview-Questions-and-Answers
Frontend
https://github.com/h5bp/Front-end-Developer-Interview-Questions
A list of helpful front-end related questions you can use to interview potential candidates, test yourself or completely ignore.
https://github.com/khan4019/front-end-Interview-Questions
Help the front End community to rock interview http://www.thatjsdude.com/interview/index.html
@chenrui333
chenrui333 / logback.xml sample config
Last active Oct 21, 2015
logback.xml sample config
View logback.xml sample config
logback.xml sample config
You can’t perform that action at this time.