Skip to content

Instantly share code, notes, and snippets.

View carlbennett's full-sized avatar
💙
Fedora Linux

Carl Bennett carlbennett

💙
Fedora Linux
View GitHub Profile
@p120ph37
p120ph37 / csd-wrapper.sh
Last active December 12, 2023 23:52
A simple implementation of a CSD-Wrapper as required for OpenConnect to comply with Cisco AnyConnect "hostscan" policies.
#!/bin/bash
unset URL TICKET STUB GROUP CERTHASH LANGSELEN
shift
while [ "$1" ]; do
if [ "$1" == "-ticket" ]; then shift; TICKET=$1; fi
if [ "$1" == "-stub" ]; then shift; STUB=$1; fi
if [ "$1" == "-group" ]; then shift; GROUP=$1; fi
if [ "$1" == "-certhash" ]; then shift; CERTHASH=$1; fi
if [ "$1" == "-url" ]; then shift; URL=$1; fi
@joltcan
joltcan / grafana-pushbullet-proxy.php
Last active June 4, 2020 09:17
Simple php-curl post to Pushbullet as a wrapper for Grafana webhooks
<?php
// simple proxy from Grafana to Pushbullet. Bare minimum.
// please update Access-token to your liking. Feel free to use device_iden if
// you want to send to a specific device. Default is all.
// usage: example.com/pushbullet-proxy.php?title=test&body=testbody
// Find your token here: https://www.pushbullet.com/#settings/account
$access_token = '<my token>';
@IMcPwn
IMcPwn / delete-all-messages.js
Last active July 12, 2023 19:41 — forked from niahoo/delete-all-messages.js
Delete all messages in a Discord channel
// Turn on Developer Mode under User Settings > Appearance > Developer Mode (at the bottom)
// Then open the channel you wish to delete all of the messages (could be a DM) and click the three dots on the far right.
// Click "Copy ID" and paste that instead of LAST_MESSAGE_ID.
// Copy / paste the below script into the JavaScript console.
// If you're in a DM you will receive a 403 error for every message the other user sent (you don't have permission to delete their messages).
var before = 'LAST_MESSAGE_ID';
clearMessages = function(){
const authToken = document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.token.replace(/"/g, "");
const channel = window.location.href.split('/').pop();
@brussell98
brussell98 / webhookRelay.js
Last active July 6, 2018 17:42
Make slack webhooks discord compatible
const express = require('express'),
bodyParser = require('body-parser'),
request = require('unirest'),
app = express();
app.disable('x-powered-by');
app.set('env', 'production');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
@carlbennett
carlbennett / resolv.conf
Created July 26, 2016 19:21
A list of nameservers to use in case of emergency
; Google DNS:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
; OpenDNS:
nameserver 208.67.222.222
nameserver 208.67.222.220
nameserver 2620:0:ccc::2
nameserver 2620:0:ccd::2
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@carlbennett
carlbennett / newrelic.mod
Last active May 8, 2016 08:41
New Relic PHP Agent SELinux Policy
@leedm777
leedm777 / AnsibleVaultDiff.md
Last active January 2, 2024 08:50
Ansible vault diff in Git

Normally, when you diff an [Ansible vault][], all you see is gibberish.

$ git diff -- group_vars/all/vault.yml
diff --git a/group_vars/all/vault.yml b/group_vars/all/vault.yml
index 245ccf4..90bf9ee 100644
--- a/group_vars/all/vault.yml
+++ b/group_vars/all/vault.yml
@@ -1,111 +1,111 @@
 $ANSIBLE_VAULT;1.1;AES256
@carlbennett
carlbennett / linux-cheatsheet.sh
Last active January 22, 2024 18:03
Cheatsheet for Fedora, CentOS, and RedHat family members of Linux
# Fix user and directory permissions:
find . -type f -print0 | sudo xargs -0 chmod 664
find . -type d -print0 | sudo xargs -0 chmod 775
# Copy user permissions to group permissions:
chmod -R g=u .
# Make new files inherit the group of the container directory
chmod g+s <directory>
@cben
cben / CF-CNAME-flattened-TTL.md
Created September 10, 2015 20:46
The problem with CloudFlare's DNS "CNAME flattening" TTL

[attaching this to a CloudFlare survey why I left them (for DNSimple)]

I was a free user using CloudFlare only for DNS, chiefly because it can simulate CNAME at an apex domain. The apex domains mathdown.net,mathdown.com point to mathdown-cben.rhcloud.com. Cloudflare "CNAME-flattening" nicely returns an A record; unfortunately it's served with a huge TTL of 7 days(!), which causes a long outage when the underlying IP changes.

I asked support how I can lower the TTL (BTW it's great that you provide free support at all) and was told [https://support.cloudflare.com/hc/en-us/requests/522551, emphasis mine]:

This is based on the TTL of your authoritative provider for mathdown-cben.rhcloud.com: