Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wifi_challenge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
42loop
wifi_challenge
Commits
1bbc417d
Commit
1bbc417d
authored
Jan 26, 2020
by
42loop
Browse files
Options
Downloads
Patches
Plain Diff
silly dump
parent
ce364276
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
udptarget/dump_db.py
+55
-0
55 additions, 0 deletions
udptarget/dump_db.py
with
55 additions
and
0 deletions
udptarget/dump_db.py
0 → 100755
+
55
−
0
View file @
1bbc417d
#!/usr/bin/python3
import
sqlite3
as
lite
import
time
con
=
lite
.
connect
(
'
udp_pings.db
'
)
def
db_purge
():
global
con
with
con
:
cur
=
con
.
cursor
()
cur
.
execute
(
"
DELETE FROM udp_pings
"
)
def
db_insert
(
ts
):
global
con
with
con
:
cur
=
con
.
cursor
()
sql
=
"
INSERT INTO pings(ts) VALUES(
'"
+
str
(
ts
)
+
"'
)
"
cur
.
execute
(
sql
)
def
db_dump
():
global
con
with
con
:
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT * FROM pings
"
)
rows
=
cur
.
fetchall
()
for
row
in
rows
:
print
(
row
)
def
db_create
():
global
con
with
con
:
cur
=
con
.
cursor
()
cur
.
execute
(
"
DROP TABLE IF EXISTS pings
"
)
cur
.
execute
(
"
CREATE TABLE pings(id INTEGER PRIMARY KEY,ts varchar(20) NOT NULL)
"
)
def
millis
():
return
int
(
round
(
time
.
time
()
*
1000
))
if
__name__
==
'
__main__
'
:
# db_create()
# db_purge()
# db_insert(millis())
db_dump
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment