Skip to content

Instantly share code, notes, and snippets.

View baddwin's full-sized avatar
🚀
moving away

Badwi baddwin

🚀
moving away
View GitHub Profile
@avoidik
avoidik / README.md
Last active March 12, 2024 13:21
Compile vaultwarden (ex. bitwarden_rs) on Raspberry Pi

How to build and install vaultwarden (ex. bitwarden_rs) on Raspberry Pi

Best advise ever: make a backup before doing any operations described below

Steps

Prepare prerequisites

sudo apt-get update
@axeleroy
axeleroy / wxr_utils.py
Created April 19, 2020 18:00
Python library for generating WXR files
"""Utility functions to create a WXR file for Wordpress.
"""
import datetime
import os
from lxml import etree as ET
from lxml.etree import CDATA
# XML namespaces declarations
@echr
echr / app.js
Last active November 23, 2023 12:05
Simple Laravel + Vue + Laravel Mix + Firebase Notification (PWA, Offline)
// FILE PATH: /resources/js/app.js
require('./bootstrap');
// Import Service Worker Registry
require('./extensions/sw-registry');
import Vue from 'vue';
...
@nealfennimore
nealfennimore / wireguard.conf
Last active June 15, 2024 10:58
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@Firsh
Firsh / lwp-cloudflare-dyndns.sh
Last active January 6, 2024 15:38
Cloudflare as Dynamic DNS
#!/bin/bash
# Cloudflare as Dynamic DNS
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/
# Update these with real values
auth_email="email@example.com"
auth_key="global_api_key_goes_here"
zone_name="example.com"
@htruong
htruong / chroot-to-pi.sh
Last active June 21, 2024 14:21
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@pwnall
pwnall / get_layout_test_fonts.sh
Last active February 26, 2024 19:11
Get the fonts needed by Chromium's LayoutTests on Fedora Linux
sudo mkdir -p /usr/share/fonts/opentype
sudo mkdir -p /usr/share/fonts/truetype
sudo dnf install -y ipa-gothic-fonts ipa-pgothic-fonts ipa-mincho-fonts ipa-pmincho-fonts
sudo mkdir -p /usr/share/fonts/opentype/ipafont-gothic
sudo cp /usr/share/fonts/ipa-gothic/ipag.ttf /usr/share/fonts/opentype/ipafont-gothic/
sudo cp /usr/share/fonts/ipa-pgothic/ipagp.ttf /usr/share/fonts/opentype/ipafont-gothic/
sudo mkdir -p /usr/share/fonts/opentype/ipafont-mincho
sudo cp /usr/share/fonts/ipa-mincho/ipam.ttf /usr/share/fonts/opentype/ipafont-mincho/
sudo cp /usr/share/fonts/ipa-pmincho/ipamp.ttf /usr/share/fonts/opentype/ipafont-mincho/
@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active June 13, 2024 19:41
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@lifehome
lifehome / webhook.gs
Created August 24, 2016 14:48
Google Forms + Webhook : JSON example
function onFormSubmit(e) {
var data = {
"form": {
"id": e.source.getId(),
"title": e.source.getTitle() ? e.source.getTitle() : "Untitled Form",
"is_private": e.source.requiresLogin(),
"is_published": e.source.isAcceptingResponses(),
},
"response": {
"id": e.response.getId(),
@noelboss
noelboss / git-deployment.md
Last active June 12, 2024 00:28
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.