Skip to content

Instantly share code, notes, and snippets.

@pascalwhoop
pascalwhoop / cleanup.sh
Created November 20, 2019 14:08
Cleans the Kubernetes API of all pods in a namespace (in our case airflow)
NAMESPACE=airflow
#edit the > 3 < in the jq statement to correspond to the number of days you want to keep pods around for
kubectl delete pod -n $NAMESPACE $(kubectl get pods -n $NAMESPACE -o json | jq -r '.items[] |
select(.status.phase != "Running") |
select(last(.status.containerStatuses)[].state | has("terminated")) |
select((last(.status.containerStatuses)[].state.terminated.finishedAt | fromdate) < (now - 60*60*24*3)) |
.metadata.name')
<html><head><meta name="viewport" content="width=device-width; height=device-height;"><title>mp3_304.mp3</title><link rel="stylesheet" href="resource://content-accessible/TopLevelVideoDocument.css"><link rel="stylesheet" href="chrome://global/skin/media/TopLevelVideoDocument.css"><script type="text/javascript" src="chrome://global/content/TopLevelVideoDocument.js"></script></head><body><video autoplay="" controls="" style="height: 40px; width: 66%;"></video></body></html>
@pascalwhoop
pascalwhoop / bootstrap.sh
Last active January 16, 2023 13:00
bootstrap script for machine learning env
#!/bin/bash
# install core requirements
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
sudo apt install -y tmux htop bmon fzf wget curl
# get brew working
curl https://gist.githubusercontent.com/pascalwhoop/4d01bb179132118c565b3db56c4ce68e/raw/fa0ab508cac760efaa399442047256a36578c62e/tmux.conf > ~/.tmux.conf
# fish shell
@pascalwhoop
pascalwhoop / PR-bootstrap.yaml
Created April 26, 2020 20:18
gcp foundation github actions
name: 'Bootstrap Terraform'
on:
- pull_request
env:
tf_version: 'latest'
tf_working_dir: '0-bootstrap'
GOOGLE_CREDENTIALS: ${{secrets.GOOGLE_CREDENTIALS}}
jobs:
terraform:
name: 'Terraform'
@pascalwhoop
pascalwhoop / smart_playlist_mpd.sh
Created June 20, 2018 11:36
Small snippet that is useful for generating smart playlists based on time added to library. I usually listen to newly added music more regularly and this is a nice help
#!/bin/bash
cd ~/Music/
find ./ -type f -mtime -31 | sed 's/\.\///g' > ~/.config/mpd/playlists/New_Last_Month.m3u
find ./ -type f -mtime -7 | sed 's/\.\///g' > ~/.config/mpd/playlists/New_Last_Week.m3u
find ./ -type f -mtime -365 | sed 's/\.\///g' > ~/.config/mpd/playlists/New_Last_Year.m3u
@pascalwhoop
pascalwhoop / ComponentInfo.txt
Last active August 11, 2020 20:05
A list of a lot of ComponentInfo strings for some 10k+ applications on the Google Play Market
AutomateIt.mainPackage/AutomateIt.mainPackage.AutomateItMainActivity
AutomateIt.mainPackage/automateItLib.mainPackage.AutomateItMainActivity
AutomateItPro.mainPackage/automateItLib.mainPackage.AutomateItMainActivity
AutomateItPro.mainPackage/automateItLib.mainPackage.MainActivity
Com.sktelecom.minit/Com.sktelecom.minit.IntroActivity
HinKhoj.Dictionary/com.hinkhoj.dictionary.activity.ConfigureActivity
PSB.Droid/md537cd9a14833c7ae877f7f1aebf31611f.SplashScreenActivity
accky.kreved.skrwt.skrwt/accky.kreved.skrwt.skrwt.LaunchScreenActivity
accky.kreved.skrwt.skrwt/accky.kreved.skrwt.skrwt.activity.LaunchScreenActivity
ace.jun.simplecontrol/ace.jun.simplecontrol.MainActivity
{
"fields": [
{
"name": "index",
"type": "integer"
},
{
"name": "type",
"type": "string"
},
@pascalwhoop
pascalwhoop / dataflow_job.tf
Created July 8, 2020 20:06
sample pipeline for data cleaning
import apache_beam as beam
import logging
import json
from apache_beam.io import ReadFromText
from apache_beam.io import BigQuerySource
from apache_beam.io import BigQuerySink
from apache_beam.io import WriteToText
from apache_beam.io.gcp.bigquery_tools import parse_table_schema_from_json
from apache_beam.io.gcp.internal.clients import bigquery
@pascalwhoop
pascalwhoop / unpack_repack.sh
Created August 3, 2017 21:31
Extracting and repackaging an android backup file
adb backup --noapk <your_apk_package_name>
#extract it, skipping the first 24. we'll use them later though, so keep the files
dd if=backup.ab bs=24 skip=1 | /usr/local/ssl/bin/openssl zlib -d > backup.tar
# do some stuff with it ...
#then repackage everything
/usr/local/ssl/bin/openssl zlib -e < ./newbackup.tar | dd of=newbackup.ab bs=24 seek=1
#reapply the first 24 bit to the file
dd if=mybackup.ab bs=24 count=1 | dd of=backup.ab bs=24 conv=notrunc
adb restore newbackup.adb #and confirm on the device
import {async, ComponentFixture, TestBed, fakeAsync, tick} from "@angular/core/testing";
import {AdminHomeComponent} from "./admin-home.component";
import {NO_ERRORS_SCHEMA} from "@angular/core";
import {PageTitleService} from "../../shared/services/page-title.service";
import {OffersApi} from "../../shared/api/endpoints/OffersApi";
import {OffersApiStub} from "../../../testing/offers-api-stub";
import {By} from "@angular/platform-browser";
import {MOCK_OFFERS} from "../../../testing/mock-data";
import {MdDialog, MdDialogModule, MdDialogRef, OverlayRef} from "@angular/material";
import * as _ from "lodash";