Skip to content

Instantly share code, notes, and snippets.

View corneliouzbett's full-sized avatar
:octocat:
Compiling dreams and ideas...

Kipchumba Bett corneliouzbett

:octocat:
Compiling dreams and ideas...
View GitHub Profile
@corneliouzbett
corneliouzbett / install-nvm-zsh.txt
Created July 8, 2019 09:26 — forked from mike-casas/install-nvm-zsh.txt
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
private void enlistCreateTable(String sql, DDLType ddlType)
throws SQLException {
String tn = ddlType.getDBObjectName(sql);
UcanaccessConnection ac = UcanaccessConnection.getCtxConnection();
String execId = UcanaccessConnection.getCtxExcId();
Connection hsqlConn = ac.getHSQLDBConnection();
Database db = ac.getDbIO();
LoadJet lfa = new LoadJet(hsqlConn, db);
lfa.synchronisationTriggers(tn, true,true);
CreateTableCommand c4io;
private static Table createUniqueTable(Database db, String name,
List<ColumnBuilder> columns,
ResultSetMetaData md,
ImportFilter filter)
throws IOException, SQLException
{
// otherwise, find unique name and create new table
String baseName = name;
int counter = 2;
while(db.getTable(name) != null) {
@corneliouzbett
corneliouzbett / JwtTokenUtil.java
Created April 26, 2019 20:19
Using Json web token (JWT) to create a token
String generateToken(Map<String, Object> claims) {
return Jwts.builder()
.setClaims(claims)
.setExpiration(generateExpirationDate())
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
}
public class Scheduler {
@Scheduled(fixedDelay = 1000, initialDelay = 3000)
public void fixedDelaySch() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date now = new Date();
String strDate = sdf.format(now);
System.out.println("Fixed Delay scheduler:: " + strDate);
}
}
def shared_locations(self):
"""
A dictionary of shared locations whose keys are in the set 'prefix',
'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'.
The corresponding value is the absolute path of that category for
this distribution, and takes into account any paths selected by the
user at installation time (e.g. via command-line arguments). In the
case of the 'namespace' key, this would be a list of absolute paths
for the roots of namespace packages in this distribution.
version: '3'
services:
postgres:
image: postgres:9.6
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
ports:
- "5432:5432"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#FBC02D</color>
</resources>
// Create the dataframe
val df = Seq("Red", "Green", "Blue").map(Tuple1.apply).toDF("color")
df.createOrReplaceTempView("data")
val df4 = sql(""" select *, case when color = 'green' then 1 else 0 end as Green_ind from data """)
df4.show()
df4:org.apache.spark.sql.DataFrame = [color: string, Green_ind: integer]
sc = spark.sparkContext
# A JSON dataset is pointed to by path.
# The path can be either a single text file or a directory storing text files
path = "examples/src/main/resources/people.json"
peopleDF = spark.read.json(path)
# The inferred schema can be visualized using the printSchema() method
peopleDF.printSchema()
# root