Skip to content

Instantly share code, notes, and snippets.

View PandelisZ's full-sized avatar
:shipit:
🔥🔥🔥 Taking working code and making it un-working 🔥🔥🔥🔥

Pandelis Zembashis PandelisZ

:shipit:
🔥🔥🔥 Taking working code and making it un-working 🔥🔥🔥🔥
View GitHub Profile
@danieldspx
danieldspx / pulumi-infra.ts
Last active November 21, 2023 16:30
An example that creates a ECS Cluster + Capacity provider with EC2 instances managed by a Auto Scaling group
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as random from "@pulumi/random";
const vpc = awsx.ec2.Vpc.getDefault();
const clusterName = 'dev-cluster';
// Create a random string that will be used to create the cluester name.
// This is usefull to avoid collision with existing clusters.
@branneman
branneman / lambda-img-to-webp.js
Created May 5, 2017 12:26
AWS Lambda@Edge whitelisted image to webp request mapper
'use strict';
const whitelist = {
'/static/img/photo.jpg': '/static/img/photo.webp'
};
exports.handler = (event, context, callback) => {
// Grab HTTP request and it's headers
const request = event.Records[0].cf.request;
@spite
spite / gist:90e3dbf8e117660f6788a5748ae06cad
Last active December 30, 2016 09:20
Go to https://lines.chromeexperiments.com/drag/, start the experience and run this code in the console
document.getElementById( 'loading' ).style.display = 'none';
var speed = .001; // changes the rate of rotation
var distance = 4; // changes the distance the point travels
function _update() {
bAmDrawing = true;
lastMouseX = 0; lastMouseY = 0;
var a = speed * performance.now();
var x = distance * Math.cos( a );
var y = distance * Math.sin( a );
stage.mousemove( { data: { global : { x: x, y: y } } } )
@bramus
bramus / toledounzipper
Last active August 20, 2018 09:00
Toledo/Blackboard Gradebook Unzipper, Unix Style.
# toledounzip
# usage: toledounzip gradebook_B-KSL-JLW323-1314_LABO04\ \(LW6\ -\ LW7\).zip
function toledounzipmain() {
if (( $# != 1 )); then
echo "Please provide the name of a .zip file generated by Toledo";
else
if [ ! -f "$1" ]; then
echo "Invalid filename";
else
echo "=== Start unzipping main zip “$1”";
@BrandonSmith
BrandonSmith / AndroidManifest.xml
Last active July 19, 2023 19:11
Quick example of how to schedule a notification in the future using AlarmManager
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.notification">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
@ljos
ljos / frontmost_window.py
Last active January 25, 2024 04:16
Find the frontmost/active window in OS X
# Copyright @ Bjarte Johansen 2012
# License: http://ljos.mit-license.org/
from AppKit import NSApplication, NSApp, NSWorkspace
from Foundation import NSObject, NSLog
from PyObjCTools import AppHelper
from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
@hyle
hyle / ko.utils.signatures.js
Last active May 14, 2022 21:15
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }