Skip to content

Instantly share code, notes, and snippets.

@shortjared
shortjared / list.txt
Last active April 18, 2024 14:17
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@codewithgun
codewithgun / laravel-local-pusher.md
Created April 22, 2021 15:40
Laravel web socket with local pusher and custom authentication

Laravel local websocket

Customized authentication will be used in this gist instead of default Auth facade provided by Laravel

Create project

composer create-project laravel-laravel your-project-name
cd your-project-name
@ESWZY
ESWZY / compress_video.py
Last active April 18, 2024 14:16
An example Python code for compressing video file to target size.
# Simplified version and explanation at: https://stackoverflow.com/a/64439347/12866353
import os
import ffmpeg
def compress_video(video_full_path, size_upper_bound, two_pass=True, filename_suffix='cps_'):
"""
Compress video file to max-supported size.
:param video_full_path: the video you want to compress.
:param size_upper_bound: Max video size in KB.
@bmabey
bmabey / bwmorph.py
Created May 24, 2018 15:58
Python implementation of matlab's `bwmorph` function for the operations:`thin`, `spur`, `bracnhes`, and `endpoints`
"""
Functions that implement some of the same functionality found in Matlab's bwmorph.
`thin` - was taken and adapted from https://gist.github.com/joefutrelle/562f25bbcf20691217b8
`spur` - Not perfect but pretty close to what matlab does via LUTs
`endpoints` - lines up perfectly with matlab's output (in my limited testing)
`branches` - this results in more clustered pixels than matlab's version but it pretty close
"""
import numpy as np
import scipy.ndimage as ndi

Tuning Windows 10 for Slow Machines

Windows 10 on slow netbook

This guide is for those who dares to install Windows 10 on slow netbooks (1GB of RAM).
Though Windows update program is over, you still may use old Windows product keys from license stickers to install Windows 10 on old machines.

UPD Jan 2019
This article is quite old, some instructions may be obsolete.

@willurd
willurd / web-servers.md
Last active April 18, 2024 14:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@butageek
butageek / windows_activation.md
Last active April 18, 2024 14:15
Activate Windows for free

For Windows 10

Step 1 - Open PowerShell or Command Prompt as administrator

Step 2 - Install KMS client key

slmgr /ipk your_license_key

Replace your_license_key with following volumn license keys according to Windows Edition:

@StevenACoffman
StevenACoffman / Homoglyphs.md
Last active April 18, 2024 14:15
Unicode Look-alikes

Unicode Character Look-Alikes

Original Letter Look-Alike(s)
a а ạ ą ä à á ą
c с ƈ ċ
d ԁ ɗ
e е ẹ ė é è
g ġ
h һ
@cantino
cantino / base64-md5-test.rb
Created February 28, 2019 23:41
Four ways to compute the base64 md5 checksum used by ActiveStorage
require 'digest'
# From activestorage
def compute_checksum_in_chunks(io)
Digest::MD5.new.tap do |checksum|
while chunk = io.read(5242880)
checksum << chunk
end
io.rewind
end.base64digest
@daverich204
daverich204 / Code.gs
Last active April 18, 2024 14:14
Yahoo Finance AppsScript for Google Sheets
function yahooF(ticker) {
const url = `https://query1.finance.yahoo.com/v8/finance/chart/${ticker}`;
const res = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
const contentText = res.getContentText();
const data = JSON.parse(contentText);
// Check if the result exists and has data
if (data && data.chart && data.chart.result && data.chart.result.length > 0) {
const regularMarketPrice = data.chart.result[0].meta.regularMarketPrice;