Skip to content

Instantly share code, notes, and snippets.

@jerlendds
jerlendds / cses.json
Last active December 13, 2023 16:44
[
{
"label": "GEOSINTsearch",
"tooltip": "Searches within posts from Twitter, Reddit and 4Chan and presents anything that contains a Google Maps link",
"value": "https://cse.google.com/cse?cx=015328649639895072395:sbv3zyxzmji"
},
{
"label": "Pasted tekst",
"tooltip": "Look if any specifc text has been posted before",
"value": "https://cse.google.com/cse/publicurl?cx=013991603413798772546:nxs552dhq8k"
@adamlacombe
adamlacombe / multiple-xlsx-to-single-csv.sh
Created December 17, 2020 23:18
Convert multiple xlsx files to csv files then merge multiple csv files into one
#!/bin/bash
# https://stackoverflow.com/a/21651707/9238321
for i in *.xlsx; do libreoffice --headless --convert-to csv "$i" ; done
# https://unix.stackexchange.com/a/558965
awk '(NR == 1) || (FNR > 1)' *.csv > all.csv
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@mbleigh
mbleigh / README.md
Last active March 28, 2024 19:14
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
#!/bin/sh
# strict mode: error if commands fail or if unset variables are used
set -eu
if [ "$#" -lt 2 ]
then
echo Usage: `basename $0` "<limit> <command>..."
echo or: `basename $0` "<memlimit> -s <swaplimit> <command>..."
exit 1
@jsprpalm
jsprpalm / viewer.html
Created May 23, 2019 12:25
Pinch zoom implementation for PDF.js viewer
<!-- Goes into viewer.html just before ending </body> -->
<script>
let pinchZoomEnabled = false;
function enablePinchZoom(pdfViewer) {
let startX = 0, startY = 0;
let initialPinchDistance = 0;
let pinchScale = 1;
const viewer = document.getElementById("viewer");
const container = document.getElementById("viewerContainer");
const reset = () => { startX = startY = initialPinchDistance = 0; pinchScale = 1; };
@snaptopixel
snaptopixel / decorator.ts
Created January 29, 2019 17:04
Stencil custom decorator example
/*
* @Component()
* class ThemedComponent {
* @Inject() theme: ITheme;
* }
*/
const theme = {foo: 'bar'};
export function Inject() {
@vdbelt
vdbelt / cloudflare-purge-cache-service-worker.js
Created August 21, 2018 11:43
A CloudFlare service worker that proxies purge cache requests. Example: https://example.com/__purge_cache?zone=XX
addEventListener('fetch', event => {
event.respondWith(purgeCache(event.request))
})
async function purgeCache(request) {
const url = new URL(request.url)
@sparrc
sparrc / install-ffmpeg.sh
Last active November 14, 2023 13:24
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
mkdir -p ~/ffmpeg_sources ~/bin
export PATH="$HOME/bin:$PATH"
@gerarldlee
gerarldlee / Installing Kali Linux as a Windows 10 Subsystem for Linux
Created January 21, 2018 01:15
Installing Kali Linux as a Windows 10 Subsystem for Linux
Installing Kali Linux as a Windows 10 Subsystem for Linux
Powershell (Admin)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
lxrun /install
git clone https://github.com/RoliSoft/WSL-Distribution-Switcher.git
cd WSL-Distribution-Switcher
python get-prebuilt.py kalilinux/kali-linux-docker