Skip to content

Instantly share code, notes, and snippets.

@jericbas
jericbas / filebrowser.service
Last active April 2, 2021 14:25
Service Linux
[Unit]
Description=Filebrowser Service
After=network.target
[Service]
WorkingDirectory=/data
PIDFile=/var/run/filebrowser.pid
ExecStart=/usr/local/bin/filebrowser --cache-dir cache
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
@jericbas
jericbas / array.js
Created October 15, 2020 20:25
Javascript Snippets
# Get Unique Values
// Option 1
var uniqueArray = ['a', 1, 'a', 2, '1', 1].filter(function(va1ue, index, self) {
return self.index0f(va1ue) === index;
});
// Option 2
var uniqueArray = [... new Set(['a', 1, 'a', 2, '1', 1])];
@jericbas
jericbas / jsconfig.json
Created September 2, 2020 08:00
JsConfig.json
{
"include": ["src"],
"exclude": [
"node_modules",
"resources",
"deploy",
"coverage",
"build",
"public",
"**/*.spec.ts"
@jericbas
jericbas / readme.md
Last active March 30, 2022 15:29
Expo in WSL 2

Instruction

Add wsl2.ps1 to Task scheduler to run on start check run with Highest Priviledges

@jericbas
jericbas / ecosystem.config.js
Created July 17, 2020 06:42
Start Crontab-ui via pm2
// Run in background
// pm2 start ecosystem.config.js
module.exports = {
apps : [{
script: 'crontab-ui',
env: {
HOST : 'XXX.XXX.X.XX',
PORT : 8000
}
@jericbas
jericbas / file.py
Created July 10, 2020 09:49
Chandelier Exit in Python
def avg_true_range(self, df):
ind = range(0,len(df))
indexlist = list(ind)
df.index = indexlist
for index, row in df.iterrows():
if index != 0:
tr1 = row["High"] - row["Low"]
tr2 = abs(row["High"] - df.iloc[index-1]["Close"])
tr3 = abs(row["Low"] - df.iloc[index-1]["Close"])
<h3>Checkboxes</h3>
<div>
<input id="checkbox-1" class="checkbox-custom" name="checkbox-1" type="checkbox">
<label for="checkbox-1" class="checkbox-custom-label">First Choice</label>
</div>
@jericbas
jericbas / app.js
Created May 5, 2020 05:23
Check if text is JSON or not
function isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
@jericbas
jericbas / sample.js
Created April 24, 2020 06:16
Move element of array of object to another position/index
const data = [
{id: 1, name: "Sample 1"},
{id: 2, name: "Sample 2"},
{id: 3, name: "Sample 3"}
]
const moveObject = (arr, targetKey, targetValue, newIndex) => {
@jericbas
jericbas / Linux.md
Last active April 21, 2020 02:53
Kll a process running on a port
sudo lsof -i:5000

kill -9 12345