Skip to content

Instantly share code, notes, and snippets.

View sendyputra's full-sized avatar
🏠
Working from home

Sendy Putra sendyputra

🏠
Working from home
  • Indonesia
  • 11:11 (UTC +07:00)
  • X @sendypw
View GitHub Profile
@sendyputra
sendyputra / proxmox_nat.sh
Created January 23, 2025 01:27
Proxmox NAT
#!/bin/bash
## Setup NAT (IP Masquerading egress + Port Forwarding ingress) on Proxmox
## See https://blog.rymcg.tech/blog/proxmox/02-networking/
SYSTEMD_UNIT="my-iptables-rules"
SYSTEMD_SERVICE="/etc/systemd/system/${SYSTEMD_UNIT}.service"
IPTABLES_RULES_SCRIPT="/etc/network/${SYSTEMD_UNIT}.sh"
## Default network address is for a /24 based on the the bridge number:
@aspose-com-gists
aspose-com-gists / compare-word-document-custom.py
Last active December 13, 2023 11:49
Compare Two Word Documents using Python
import aspose.words as aw
from datetime import date
# load first document
doc = aw.Document("calibre.docx")
# load second document
doc2 = aw.Document("calibre2.docx")
# set additional options
@paulonteri
paulonteri / cloud_build.yaml
Created October 31, 2021 05:43
Deploy a React Native app to PlayStore using Google Cloud Build
timeout: 3600s
logsBucket: 'gs://$_CACHE_BUCKET'
options:
# machineType: 'E2_HIGHCPU_8'
steps:
- name: 'reactnativecommunity/react-native-android'
entrypoint: bash
args:
- -c
@sindresorhus
sindresorhus / esm-package.md
Last active July 2, 2025 19:35
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
#!/bin/bash
# Delete all duplicate rules
/sbin/service iptables save
/sbin/iptables-save | awk '/^COMMIT$/ { delete x; }; !x[$0]++' > /tmp/iptables.conf
/sbin/iptables -F
/sbin/iptables-restore < /tmp/iptables.conf
/sbin/service iptables save
/sbin/service iptables restart
if [ -f /tmp/iptables.conf ] ; then /bin/rm -f /tmp/iptables.conf ; fi
@iconifyit
iconifyit / 05-array-to-tree.js
Created February 17, 2020 14:25
30 Days of Algorithms : Day 05 - Create a tree from a flat array.
/**
* Converts a flat array to a tree with runtime O(n)
*
* Big-O : O(n)
*
* This algorithm was taken from Phillip Stanislaus's "Performant Array to Tree"
* which has O(n) complexity. It builds the tree in a single pass.
* @link https://github.com/philipstanislaus
* @link https://www.npmjs.com/package/performant-array-to-tree
* @see https://github.com/iconifyit/30-Days-of-Algorithms
@GAS85
GAS85 / apache2_HPKP.md
Last active January 25, 2024 14:03
Activating HTTP Public Key Pinning (HPKP) on Let's Encrypt

Activating HTTP Public Key Pinning (HPKP) on Let's Encrypt

Source: https://lilleengen.io/blog/index.php/posts/activating-http-public-key-pinning-hpkp-on-lets-encrypt

  • Disclaimer: This might break your website, don't preceded if you don't know what you're doing.

Since the letsencrypt seems to create a new private key every time the certificate is renewed and Let's Encrypt requires you to renew you certificate once every ~80 days pinning using your certificate's SPKI is probably not the way to go. So, what should we pin then? Let's Encrypt is currently issuing from Authority X3, and using Authority X4 as a backup, so these two is a great place to start. We should also include the ISRG Root so this might support new Authorities with other SPKIs as well.

Generate HASH of Private Keys

To generate the hash of the SPKI of these certificates run the following commands

@mmazzarolo
mmazzarolo / elevations.ts
Last active June 1, 2022 15:12
React-Native cross platform elevation definitions
/**
* React-Native cross-platform elevations.
* Based on https://ethercreative.github.io/react-native-shadow-generator/
*
* Usage:
* 1. Import "elevations" from this file
* import { elevations } from "config/elevations";
* 2. Use it. Assuming you need an elevation of 2 (based on the Android
* elevation standard), doing the following will cast the same shadow
* on both platforms:
@rkttu
rkttu / Dockerfile
Last active April 14, 2025 04:55
Run Office 2019 in Windows Full Container (19H1)
FROM mcr.microsoft.com/windows:1903 AS build
WORKDIR C:\\odtsetup
ADD https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_11617-33601.exe odtsetup.exe
RUN odtsetup.exe /quiet /norestart /extract:C:\\odtsetup
FROM mcr.microsoft.com/windows:1903 AS download
WORKDIR C:\\odtsetup
COPY --from=build C:\\odtsetup\\setup.exe .
@pavankjadda
pavankjadda / How to fix gitignore not working issue.md
Last active June 2, 2025 11:40
How to fix "gitignore not working" issue

FYI: Created blog post with more details

How to fix ".gitignore not working" issue?

Sometimes git does not exclude files/folders added .gitignore especially if you had commited them before. Here is how to fix it. I am ignoring node_modules from Angular project as an example

  1. Update .gitignore with the folder/file name you want to ignore. You can use anyone of the formats mentioned below (prefer format1)
### Format1  ###
node_modules/