Skip to content

Instantly share code, notes, and snippets.

@xjohnwu
xjohnwu / schedule.py
Created July 14, 2022 09:12
python scheduler
import schedule
schedule.every(60).minutes.do(runner.run_all_strategies)
@xjohnwu
xjohnwu / parse_bool_env_var.py
Created July 14, 2022 08:19
Parse boolean type from environment variable
is_encrypt = strtobool(os.getenv("IS_ENCRYPT", "FALSE"))
@xjohnwu
xjohnwu / listext.js
Created July 20, 2021 03:02
List extensions
function remove(list, item) {
return list.filter(ele => ele != item)
}
@xjohnwu
xjohnwu / zfill_demo.py
Created December 17, 2020 13:59
A股代码补足6位
code=311
print(str(code).zfill(6)) # 000311

Keybase proof

I hereby claim:

  • I am xjohnwu on github.
  • I am xjohnwu (https://keybase.io/xjohnwu) on keybase.
  • I have a public key ASAV9xvYAvPVS8I1lcGT0N9vxXO2UJb_DPhkfpSsI4Z5Mwo

To claim this, I am signing this object:

@xjohnwu
xjohnwu / AddColumn.sql
Created September 15, 2015 15:37
Add column
IF NOT EXISTS( SELECT 1 FROM information_schema.columns WHERE table_name = 'reportsInstruments' AND column_name = 'Commentary' )
BEGIN
ALTER TABLE reportsInstruments ADD Commentary bit NOT NULL DEFAULT 1
END
GO
@xjohnwu
xjohnwu / CreateTable.sql
Created September 15, 2015 15:35
Create table sql template
IF EXISTS (SELECT * FROM dbo.sysobjects where id = object_id(N'Config_Index_Fixings') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [Config_Index_Fixings]
GO
CREATE TABLE [dbo].[Config_Index_Fixings](
[MurexIndex] [varchar](50) NOT NULL,
CONSTRAINT [PK_Config_Index_Fixings] PRIMARY KEY CLUSTERED
(
[MurexIndex]