Skip to content

Commit

Permalink
misc minor
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Nov 24, 2020
1 parent 1ebdba3 commit 6749395
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion category-cycles/get_edges.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
select cl_from as subcat, page_id as parentcat
from categorylinks
join page on page_namespace = 14 and page_title = cl_to
where cl_type = 'subcat';
where cl_type = 'subcat';
4 changes: 2 additions & 2 deletions feature-historian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ for await (let pg of reader) {
let faXActionParams = template.parameters.filter(p => /^fa[cr]/i.test(p.value.trim()));
let nums = faXActionParams.map(p => {
let numMatch = String(p.name).match(/\d+$/);
return numMatch && numMatch[0];
}).filter(e => e).sort();
return numMatch && parseInt(numMatch[0]);
}).filter(e => e).sort((a, b) => a < b ? -1 : 1);

if (nums.length === 0) {
noFaXParams.push(pg.title.slice('Talk:'.length));
Expand Down
3 changes: 1 addition & 2 deletions g13-watch/save-to-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function logError(err) {
function logWarning(evt) {
try {
const stringified = JSON.stringify(evt, null, 2);
botbase_1.fs.appendFileSync('./warnlog.txt', `\n[${new botbase_1.bot.date().format('YYYY-MM-DD HH:mm:ss')}: ${stringified}`);
botbase_1.fs.appendFileSync('./warnlog.txt', `\n[${new botbase_1.bot.date().format('YYYY-MM-DD HH:mm:ss')}]: ${stringified}`);
}
catch (e) { // JSON.stringify fails on circular object
logError(e);
Expand Down Expand Up @@ -114,4 +114,3 @@ async function go() {
});
}
go();
//# sourceMappingURL=save-to-db.js.map
2 changes: 1 addition & 1 deletion g13-watch/save-to-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function logError(err) {
function logWarning(evt) {
try{
const stringified = JSON.stringify(evt, null, 2);
fs.appendFileSync('./warnlog.txt', `\n[${new bot.date().format('YYYY-MM-DD HH:mm:ss')}: ${stringified}`);
fs.appendFileSync('./warnlog.txt', `\n[${new bot.date().format('YYYY-MM-DD HH:mm:ss')}]: ${stringified}`);
} catch(e) { // JSON.stringify fails on circular object
logError(e);
}
Expand Down
46 changes: 23 additions & 23 deletions run-job.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/python3

import sys
import os

try:
runjob = sys.argv[1].lower()
except IndexError:
print('USAGE: python run-task.py <jobname>')
sys.exit(1)

with open('/data/project/sdzerobot/SDZeroBot/crontab', 'r') as crontab:
lines = crontab.read().splitlines()
lines = [line for line in lines if not line.startswith('#') and line.strip() is not '']
for line in lines:
job = line.split()[8].lower()
if job[4:] == runjob:
command = ' '.join(line.split()[5:])
print('> ' + command)
os.popen(command)
break
else:
print('no matching cron job')
#!/usr/bin/python3

import sys
import os

try:
runjob = sys.argv[1].lower()
except IndexError:
print('USAGE: python run-task.py <jobname>')
sys.exit(1)

with open('/data/project/sdzerobot/SDZeroBot/crontab', 'r') as crontab:
lines = crontab.read().splitlines()
lines = [line for line in lines if not line.startswith('#') and line.strip() is not '']
for line in lines:
job = line.split()[8].lower()
if job[4:] == runjob:
command = ' '.join(line.split()[5:])
print('> ' + command)
os.popen(command)
break
else:
print('no matching cron job')

0 comments on commit 6749395

Please sign in to comment.