Skip to content

Instantly share code, notes, and snippets.

View 524c's full-sized avatar

Roger Lucas 524c

View GitHub Profile
@JamesMessinger
JamesMessinger / swagger.json
Last active September 24, 2022 14:53
ShipEngine API definition
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "ShipEngine"
},
"host": "api.shipengine.com",
"schemes": [
"https"
],
@acoyfellow
acoyfellow / hooks.js
Last active February 12, 2023 01:22
hooks.js CSP example
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
// https://scotthelme.co.uk/content-security-policy-an-introduction/
// scanner: https://securityheaders.com/
const rootDomain = `your-domain.com`; // or your server IP for dev
const directives = {
'img-src': [
"*",
"'self'",
@penglei
penglei / a-qemu-install-debian-arm64.sh
Last active April 5, 2023 09:07
run qemu-aarch64 on macOS
#!/bin/bash
#qemu-img create -f qcow2 disk.qcow2 20G
#qemu-img create -f qcow2 varstore.img 128M
debian_iso=debian-9.6.0-arm64-xfce-CD-1.iso
qemu-system-aarch64 -smp cpus=6 -M virt -cpu max -m 2G -nographic \
-drive file=QEMU_EFI.img,if=pflash,format=raw \
-drive file=varstore.img,if=pflash \
-drive file=disk.qcow2,if=virtio \
-drive file=$debian_iso,if=virtio,format=raw
@sttk
sttk / javascript-prototype-pollution.md
Last active April 7, 2023 15:13
Javascript Prototype Pollution

Javascript Prototype Pollution

Javascript prototype specification

// Not only Object but also other types. (Function, Array, String, Number, ...)
Object.prototype.prop1 = 1;
Object.prototype.func1 = () => 'Hello!';                                        

const obj1 = {};
@ajhwb
ajhwb / libevent-example.c
Created September 9, 2012 17:17
Asynchronous network I/O using libevent
/*
* Libevent is a high-performance and portable asynchronous networking I/O library (http://libevent.org)
* This is small program to demonstrate the basic of libevent programming
*
* Copyright (C) 2012, Ardhan Madras <ardhan@rocksis.net>
*/
#include <event.h>
#include <arpa/inet.h>
#include <netinet/in.h>
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@tuananh
tuananh / configmap.yaml
Last active November 17, 2023 13:00
Pi-hole on Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: pihole-config
data:
WEBPASSWORD: pihole
TZ: 'Asia/Ho_Chi_Minh'
DNS1: 1.1.1.1
DNS2: 1.0.0.1
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@klepsydra
klepsydra / sync-fail2ban.sh
Last active January 11, 2024 15:11
Block globally reported hack attempts using your local iptables firewall rules
#!/bin/bash
## Update fail2ban iptables with globally known attackers.
## Actually, runs 100% independently now, without needing fail2ban installed.
##
## /etc/cron.daily/sync-fail2ban
##
## Author: Marcos Kobylecki <fail2ban.globalBlackList@askmarcos.com>
## http://www.reddit.com/r/linux/comments/2nvzur/shared_blacklists_from_fail2ban/
@tcdowney
tcdowney / ubuntu-sleep.yaml
Created June 27, 2020 00:54
Ubuntu Sleep Pod
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
app: ubuntu
spec:
containers:
- image: ubuntu
command: