Skip to content

Instantly share code, notes, and snippets.

View YossiCohen's full-sized avatar
🍍
Be a Pineapple - Stand tall, wear a crown, and be sweet on the inside

Yossi Cohen YossiCohen

🍍
Be a Pineapple - Stand tall, wear a crown, and be sweet on the inside
View GitHub Profile
@imthenachoman
imthenachoman / Developing a GAS Powered Google Workspace Add-on And Launching It To The Marketplace.md
Last active May 20, 2024 04:13
Developing a GAS Powered Google Workspace Add-on And Launching It To The Marketplace
@opyate
opyate / README.md
Last active May 18, 2024 21:55
Simple no-cache gamedev-friendly Python 3 webserver for testing web builds locally

Seeing this when running an HTML5 Godot game?

image

This is a simple no-cache Python 3 gamedev-friendly webserver which runs on port 4443.

Run with

python3 gamedevweb.py
@M1ke
M1ke / bash.md
Last active September 7, 2020 14:37
Generally useful stuff for bash

Felt I should collate useful stuff I constantly bounce between files to look up

Expand alias (when in interactive terminal)

Ctrl + Alt + e

(Ubuntu)

Exit if variable (e.g. envvar) isn't set

@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active May 19, 2024 18:56
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@GregBaugues
GregBaugues / token.rb
Last active July 11, 2022 02:21
Google API OAuth 2.0 refresh token (Ruby on Rails)
# The OAuth access token provided by the Google API expires in 60 minutes. After expiration,
# you must exchange a refresh token for a new access token. Unfortunately, the the Google API
# ruby gem does not include a method for refreshing access tokens.
# You can read up on how to refresh an access token here:
# https://developers.google.com/accounts/docs/OAuth2WebServer#refresh
# This Token model implements that process. It's based off of a Token model that can be created
# by running:
# rails g model Token token:text refresh_token:string expires_at:datetime
@willurd
willurd / web-servers.md
Last active May 23, 2024 20:20
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
@M1ke
M1ke / disk-usage-alert.sh
Last active February 21, 2024 15:35
A shell script to check your disk usage and alert you if it hits a limit. Change the value (percentage) in the "if" statement on line 7 to alter the threshold. Change the email address to your email address. See readme for mail.cf instructions and crontab.
#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
used=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 80 ]; then
echo "The partition \"$partition\" on $(hostname) has used $used% at $(date)" | mail -s "Disk space alert: $used% used" your@email.com
fi
done