Skip to content

Instantly share code, notes, and snippets.

View emmiedev's full-sized avatar
playing

EmmieDev emmiedev

playing
View GitHub Profile
@emmiedev
emmiedev / gist:38799b6700465d24750decedc50d8780
Created June 15, 2023 18:09
git remove big file in commit
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s"
git filter-branch --tree-filter 'rm -f ps1.zip' HEAD
OR
$ git filter-branch --index filter 'git rm --cached --ignore-unmatched blob.txt' HEAD
@emmiedev
emmiedev / start_wwan.sh
Created September 2, 2022 12:05 — forked from NiKiZe/start_wwan.sh
Start MC7700 LTE on Raspberry Pi
#!/bin/bash
# Connect a Raspberry Pi to LTE using MC7700 Mini PCI Modem with adapter to USB-C
sudo qmicli -d /dev/cdc-wdm0 -p --wds-stop-network
sudo cat /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set dev wwan0 down
# Enable OS Raw IP Mode setting (not persistent)
sudo su -c "echo Y > /sys/class/net/wwan0/qmi/raw_ip"
sudo qmicli -d /dev/cdc-wdm0 -p --device-open-net="net-raw-ip|net-no-qos-header" --wds-start-network="ip-type=6" --client-no-release-cid
crontab -e
cat << EOF > /var/spool/cron/crontabs/username
@reboot /home/username/services/rtc
* * * * * /home/username/services/updata
* * * * * ~/services/updata2
EOF
sudo dd if=/dev/zero of=/swapfile bs=1024 count=4096000
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
sudo swapon --show
sudo free -h
sudo sysctl vm.swappiness=50
docker run --restart=always --name=mysql -e MYSQL_ROOT_PASSWORD=123456789 -e MYSQL_DATABASE=database_name -p 3306:3306 -d mysql
apt-get update && \
apt-get install -yq tzdata && \
ln -fs /usr/share/zoneinfo/Asia/Bangkok /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
# @2021 Create by Tawatchai Insree
import smbus
import time
import datetime
import os, subprocess
address = 0x68
register = 0x00
#sec min hour week day month year
The use of the I2C DS3231/3232 from Armbian SBC has a few quirks, most tutorials on the internet works but only if you have internet connection.
In cuba we can sometimes use Armbian on devices that are not internet connected, so most tutorial fails and after a power failure or reboot you get a non working system because some apps/soft warns and fail with a "date in the future" message.
I have crafted a way to use it as a real systemd service (yes, it's a legacy service...)
Create a file named: rtc_ds1307 in /etc/init.d/ you can use the command below (root privileges are required)
```
nano /etc/init.d/rtc_ds1307