Skip to content

Instantly share code, notes, and snippets.

View Thor-x86's full-sized avatar
Coding with Coffee

Athaariq Ardhiansyah Thor-x86

Coding with Coffee
View GitHub Profile
@derpston
derpston / gist:2069716
Created March 18, 2012 07:42
Unpacking and repacking initramfs images
# Unpack
gzip -cd /boot/initramfs.example | cpio -i
# Repack
find . | cpio --dereference -o -H newc | gzip > /boot/initramfs.example
@bmccormack
bmccormack / movingAvg.c
Created March 31, 2015 01:05
Moving average example in C
#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;
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 26, 2024 16:55
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@w1ndy
w1ndy / ipv6-router.sh
Created January 22, 2021 20:57
Enable IPv6 passthrough with ebtables and prohibit unwanted incoming connections with iptables
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
@nucther
nucther / get-password-fiberhome.js
Created November 14, 2021 02:31
Get Password PPPoE Indihome ( Fiberhome )
// 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)