Skip to content

Instantly share code, notes, and snippets.

@spajak
spajak / mpeg2mkv-steps.ps1
Last active May 11, 2024 23:21
Convert/rip DVD to MKV. Encode to MPEG-4 & merge into MKV - all without GUI, only command line tools
# My steps to:
# Convert DVD Video to MPEG-4 in MKV without GUI, using only CLI (Command Line Interface) tools.
# No need for MeGUI, Avisynth, Handbrake etc..
# ------------------------------------------------------------------------------
# Tools needed: `mediainfo`, `ffmpeg` & `ffprobe`, `x264`, `mkvmerge`, `mplayer` (optional).
# Google for them. Use latest versions. Windows tip: avoid Cygwin and get
# the official builds, x64, when possible.
# Before start use `mediainfo` & `ffprobe` and note down informations about the source material:
@dvessel
dvessel / lmame
Last active May 11, 2024 23:19
Launch MAME through fuzzy search (fzf).
#!/usr/bin/env zsh
zparseopts -D -E - {p,-rom-path}:=rompath || return 1
scandir=${${${rompath[-1]:a}:-`eval print $( mame -showconfig | awk '$1=="rompath" { $1=""; print $0 }' )`}}
if [[ ! -d $scandir ]]; then
printf "rom path not found:%s\n" "$scandir" >&2
return 1
fi
@TheGreatBonnie
TheGreatBonnie / research.ts
Last active May 11, 2024 23:17
Research.ts
/**
* This is a port of GPT Newspaper to LangGraph JS, adapted from the original Python code.
*
* https://github.com/assafelovic/gpt-newspaper
*/
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
import { ChatOpenAI } from "@langchain/openai";
import { StateGraph, END } from "@langchain/langgraph";
import { RunnableLambda } from "@langchain/core/runnables";
import { TavilySearchAPIRetriever } from "@langchain/community/retrievers/tavily_search_api";
@ciamarro
ciamarro / livewire-directive.md
Created March 18, 2020 13:15
@livewire directive for phpstorm
  1. File > Settings > Languages & Frameworks > PHP > Blade
  2. Uncheck use default settings
  3. Directives > +
  4. Name livewire
  5. Prefix <?php '', [
  6. Suffix ])?&gt;
@rponte
rponte / Spring_propagations.md
Created May 26, 2014 02:18
Differences between PROPAGATION_REQUIRES_NEW and PROPAGATION_NESTED propagation in Spring transactions
  • PROPAGATION_REQUIRES_NEW starts a new, independent "inner" transaction for the given scope. This transaction will be committed or rolled back completely independent from the outer transaction, having its own isolation scope, its own set of locks, etc. The outer transaction will get suspended at the beginning of the inner one, and resumed once the inner one has completed.

Such independent inner transactions are for example used for id generation through manual sequences, where the access to the sequence table should happen in its own transactions, to keep the lock there as short as possible. The goal there is to avoid tying the sequence locks to the (potentially much longer running) outer transaction, with the sequence lock not getting released before completion of the outer transaction.

  • PROPAGATION_NESTED on the other hand starts a "nested" transaction, which is a true subtransaction of the existing one. What will happen is that a savepoint will be taken at the start of the nested transaction. I
@ethack
ethack / TypeClipboard.md
Last active May 11, 2024 23:06
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.

@johnmeehan
johnmeehan / index.html
Created October 18, 2020 18:34
Stimulus js Checkbox toggle
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="main.css">
<script src="bundle.js" async></script>
</head>
<body>
<div data-controller="toggler">
<label>Toggle Me</label>
@assiless
assiless / MagiskSupport.md
Last active May 11, 2024 23:04
MagiskOnRedroid
setup variables for commands
echo -e "\n
export image=redroid/redroid:11.0.0-amd64
export image_tar=${HOME}/redroid:11.0.0-amd64" >> ${HOME}/.bashrc
source ${HOME}/.bashrc
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "usage: sh thread-analyze.sh <pid> <number-of-dumps> <interval>"
exit
fi
count=$2
for i in `seq 1 $count`;
do
jstack -l $1 > thread_dump_`date "+%F-%T"`.txt &
@JayFoxRox
JayFoxRox / convert.sh
Created January 7, 2018 05:41
N64 ROM (z64) to ELF
#!/usr/bin/bash
# Get entry point from N64 ROM
dd if=test.z64 bs=1 skip=8 count=4 of=entrypoint >& /dev/null
# Convert entrypoint to little endian
#mips-elf-objcopy -I binary -O binary --reverse-bytes=4 entrypoint entrypoint
# Construct an ELF
mips-elf-objcopy -I binary test.z64 -O elf32-bigmips -B mips --adjust-section-vma .data+0x80000000 foo.elf
# Patch to MIPS III
printf '\x20\x00\x00\x00' | dd bs=1 seek=36 count=4 conv=notrunc of=foo.elf >& /dev/null