See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
// Login to fiberhome modem | |
// Paste this script inside browser console | |
$.ajax({ | |
url: '/cgi-bin/ajax?ajaxmethod=get_allwan_info', | |
success: (data)=>{ | |
data = JSON.parse(data) | |
data.wan.forEach(v => { | |
if(v.AddressingType == 'PPPoE'){ | |
console.log("Username: "+ v.Username) |
modprobe ip6table_mangle | |
ebtables -t broute -A BROUTING -p ! ipv6 -j DROP -i eth2.2 | |
brctl addif br0 eth2.2 | |
echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables | |
ip6tables -I FORWARD 1 -m physdev -m state --physdev-in eth2.2 --state NEW -j DROP | |
ip6tables -I FORWARD 1 -m physdev -m state --physdev-in eth2.2 -p udp --dport 6881 --state NEW -j ACCEPT | |
ip6tables -I FORWARD 1 -m physdev -m state --physdev-in eth2.2 -p tcp --dport 5000 --state NEW -j ACCEPT | |
ip6tables -I FORWARD 1 -m physdev -m state --physdev-in eth2.2 -p tcp --dport 6443 --state NEW -j ACCEPT | |
ip6tables -I FORWARD 1 -m physdev -m state --physdev-in eth2.2 -p tcp --dport 8096 --state NEW -j ACCEPT |
//**dataURL to blob** | |
function dataURLtoBlob(dataurl) { | |
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], | |
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); | |
while(n--){ | |
u8arr[n] = bstr.charCodeAt(n); | |
} | |
return new Blob([u8arr], {type:mime}); | |
} |
#include <stdio.h> | |
int movingAvg(int *ptrArrNumbers, long *ptrSum, int pos, int len, int nextNum) | |
{ | |
//Subtract the oldest number from the prev sum, add the new number | |
*ptrSum = *ptrSum - ptrArrNumbers[pos] + nextNum; | |
//Assign the nextNum to the position in the array | |
ptrArrNumbers[pos] = nextNum; | |
//return the average | |
return *ptrSum / len; |
# Unpack | |
gzip -cd /boot/initramfs.example | cpio -i | |
# Repack | |
find . | cpio --dereference -o -H newc | gzip > /boot/initramfs.example |