Skip to content

Instantly share code, notes, and snippets.

@PiDelport
PiDelport / slack-web-workspace-sidebar.user.js
Last active December 28, 2022 18:06
Slack Web Workspace Sidebar
// ==UserScript==
// @name Slack Web Workspace Sidebar
// @description Enable the workspace sidebar on the web version of Slack.
// @namespace https://github.com/PiDelport/
// @author Pi Delport <pjdelport@gmail.com>
// @version 1.0
// @license MIT
// @homepageURL https://gist.github.com/PiDelport/513676916e8fc186a09edfc8965a410b
// @match https://app.slack.com/*
// ==/UserScript==
@pio2pio
pio2pio / main.tf
Created May 25, 2020 12:11
Terraform template remove empty lines and comment lines starting with '#' symbol
variable "match_comment" { default = "/(?U)(?m)(?s)(^#.*$)/" }
variable "match_empty_line" { default = "/(?m)(?s)(^[\r\n])/" }
resource "helm_release" "myapp" {
name = "myapp"
chart = "${path.module}/charts/myapp"
values = [
replace(
replace(
templatefile("${path.module}/templates/values-override.yaml.tpl", {
@alukach
alukach / parse-inventory-progress.py
Last active October 6, 2023 18:40
Parsing S3 Inventory results in Python
#! /usr/bin/env python3
"""
A utility to stream records from one or many S3 Inventory reports, with a progress bar.
./parse-inventory-progress s3://my-bucket/path/to/my/inventory/2019-12-15T00-00Z/manifest.json > out.csv
"""
import json
import csv
import gzip
import sys
@iiie
iiie / qr2f.py
Last active June 1, 2019 08:52
#!/usr/bin/env python
"""
Dependancies:
pip install "qrtools==1.4" "pyotp==2.2.6" "urllib3==1.23"
Usage:
qr2f.py /path/to/screenshot1 [screenshot2 [screenshot3]]
"""
import urllib
import qrtools
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@pgolding
pgolding / example.md
Last active August 25, 2023 16:07
Passing AWS Lambda Function parameters using the ClientContext object in Python

Boto3 documentation for lambda_client.invoke suggests it is possible to pass data via the ClientContext object as a string.

The string is required to be base64 encoded JSON.

To encode such a string, use:

import baseb4
base64.b64encode(b'<string>').decode('utf-8')
@countingpine
countingpine / ext2scan.c
Last active December 19, 2021 18:06
ext2scan: scan for ext2/ext3/ext4 partitions
/* ext2scan:
* Scans an input stream, sector by sector, for something that looks like an ext{2,3,4} partition.
* It does this by looking for a magic WORD, 0xEF53, at a known offset into the sector.
* For random data, this will occur by chance around once per 32MB of data, so we also
* check whether the first two sectors are all zeros, which is commonly true for ext partitions.
*
* Compile with:
* gcc ./ext2scan.c -o ./ext2scan
*
* Example usage:
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active February 29, 2024 16:29
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@TimKraemer
TimKraemer / wifionice
Last active May 3, 2023 15:46 — forked from vollkorn1982/wifionice
HowTo auto connect your Linux to the German Wifi on ICE trains
#!/bin/sh
# put this file in /etc/network/if-up.d/
if iwconfig wlp4s0 | grep -c "ESSID:\"WIFIonICE\""
then
curl -s "https://www.ombord.info/hotspot/hotspot.cgi?connect=&method=login&realm=db_advanced_wifi"
fi