Skip to content

Instantly share code, notes, and snippets.

View mlabieniec's full-sized avatar

Michael Labieniec mlabieniec

View GitHub Profile
@mlabieniec
mlabieniec / fix-suspend.sh
Created December 8, 2020 23:07
Macbook Pro Ubuntu 20.10+ suspend fix
#!/bin/sh -e
# Disables the lid (you would need to use the power button)
# echo LID0 > /proc/acpi/wakeup
# Disables (I think) the yubikey usb which i think fires the wake event causing suspend to not work
echo XHC1 > /proc/acpi/wakeup
@mlabieniec
mlabieniec / facetimehd.sh
Last active December 8, 2020 23:05
Macbook Pro Facetime HD Webcam fix in Ubuntu 12.04+
sudo apt-get install git
sudo apt-get install curl xzcat cpio
git clone https://github.com/patjak/facetimehd-firmware.git
cd facetimehd-firmware
make
sudo make install
cd ..
sudo apt-get install kmod libssl-dev checkinstall
git clone https://github.com/patjak/bcwc_pcie.git
cd bcwc_pcie
@mlabieniec
mlabieniec / predictions.md
Last active August 2, 2019 13:02
Sample Ionic App

Sample Ionic app

First, be sure you have the latest Ionic CLI installed, then generate a new app (for this example you can use any template, but it's simplest to start with the Blank template to start):

$ npm i -g ionic
$ ionic start predictions blank # the first argument is your project name, the second the template

Update the src/polyfills.ts and add to the top of the file (window as any).global = window;. Then, update the src/tsconfig.app.json file and add the "node" types:

:host {
opacity: 0.8;
}
.content {
margin: 0.5em;
text-align: center;
}
.full-width {
margin-top: 1em;
width: 100%;
@mlabieniec
mlabieniec / ios-install.component.html
Last active October 28, 2018 18:05
iOS PWA Install Notification HTML
<div class="content">
Install this app on your device.
<br/>Tap the share icon and then <br/><strong>Add to homescreen</strong>.
<div class="full-width"><mat-icon>arrow_downward</mat-icon></div>
</div>
<button class="btn-close" mat-icon-button (click)="close()" aria-label="Close">
<mat-icon>close</mat-icon>
</button>
@mlabieniec
mlabieniec / app.component.ts
Created October 28, 2018 16:28
PWA iOS Detection and Installation Banner
ngOnInit() {
// Detects if device is on iOS
const isIos = () => {
const userAgent = window.navigator.userAgent.toLowerCase();
return /iphone|ipad|ipod/.test( userAgent );
}
// Detects if device is in standalone mode
const isInStandaloneMode = () => ('standalone' in (window as any).navigator) && ((window as any).navigator.standalone);
// Checks if should display install popup notification:
@mlabieniec
mlabieniec / index.html
Created October 28, 2018 16:10
Custom iOS PWA Splash Screen
<link rel="apple-touch-startup-image" href="assets/splash/launch-640x1136.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="assets/splash/launch-750x1294.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="assets/splash/launch-1242x2148.png" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="assets/splash/launch-1125x2436.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="assets/splash/launch-1536x2048.png" media="(min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
<lin
{
"hosting": {
"S3AndCloudFront": {
"service": "S3AndCloudFront",
"providerPlugin": "awscloudformation",
"providerMetadata": {
"s3TemplateURL": "https://s3.amazonaws.com/xxx/hosting/template.json",
"logicalId": "hostingS3AndCloudFront"
},
"lastPushTimeStamp": "2018-10-27T18:39:35.710Z",
<div class="container">
<mat-sidenav-container
fullscreen
[hasBackdrop]="mobileQuery.matches">
<mat-sidenav #lnav
mode="over"
class="sidenav">
<div class="content">
<mat-list>
<mat-list-item *ngFor="let route of nav">
@mlabieniec
mlabieniec / Delete all Public S3 Buckets
Last active December 5, 2018 20:07
This bash command will delete ALL S3 buckets that do not have versions. This will delete anything public (but also private based on your creds) but will error out on any deployment buckets (used for lambda etc.) Use at your own risk!
#!/bin/bash
aws s3api list-buckets --query 'Buckets[*].[Name]' --output text | xargs -I {} bash -c 'aws s3 rb s3://{} --force'