Skip to content

Instantly share code, notes, and snippets.

View energee's full-sized avatar
:atom:
Coding

Ted Slesinski energee

:atom:
Coding
View GitHub Profile
@energee
energee / refresh-if-changed.sh
Last active November 17, 2021 07:24
Checks a page for new content, and if it has changed refreshes chromium
#!/bin/bash
site="https://menu.lolev.beer"
previous=`cat checksum`
current=`curl -s $site | md5sum`
echo "$current" > checksum
echo "Previous contents of page: $previous"
echo "Current contents of page: $current"
@energee
energee / sizes.sql
Created July 2, 2020 11:26
Get size of all Tables
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "db"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
@energee
energee / cabana-fingerprint.js
Last active August 20, 2019 07:23 — forked from gregjhogan/cabana-fingerprint.js
cabana fingerprint
const fs = require('fs');
const content = fs.readFileSync('./data.csv', 'utf8');
const messages = content
.split('\n')
.map(line => line.trim())
.filter(line => line.length > 0 && line !== 'time,addr,bus,data')
.map(line => line.split(','))
.map(msg => ({
addr: parseInt(msg[1]),
[alias]
a = add
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
dmerged = "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
@energee
energee / can_replay.py
Last active July 4, 2019 16:00
CAN Replay
#!/usr/bin/env python
import sys
import time
import struct
from panda import Panda
DEBUG = False
def main():
logfile = sys.argv[1]
#!/bin/bash
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
@energee
energee / xbox_carcontroller.py
Last active August 28, 2019 15:46
User xbox controller to command openpilot
#!/usr/bin/env python
from evdev import InputDevice
from select import select
import time
import numpy as np
import zmq
from cereal import car
import selfdrive.messaging as messaging
@energee
energee / cabana_fingerprint.js
Last active December 7, 2017 07:04 — forked from mcampa/cabana_fingerprint.js
cabana_fingerprint.js
const fs = require('fs');
const content = fs.readFileSync('./data.csv', 'utf8');
const data = content.trim()
.split('\n')
.filter(l => l)
.map(l => l.split(','))
.map(row => ({ time: row[0], id: `${row[2]}:${row[1]}`, message: row[3] }))
const ids = {};
@energee
energee / Can_message_forwarding.h
Last active October 13, 2017 02:40
Can message forwarding for panda
// added this at the end of CAN_RX()
// make a copy
CAN_FIFOMailBox_TypeDef tx_to_push;
tx_to_push.RDHR = to_push.RDHR;
tx_to_push.RDLR = to_push.RDLR;
tx_to_push.RDTR = to_push.RDTR;
tx_to_push.RIR = to_push.RIR;
int flags = (tx_to_push.RDTR >> 4) & 0xF;
@energee
energee / wget-ftp.sh
Created May 24, 2016 01:48
Wget a folder through FTP
wget -m ftp://username:password@ip:21