Skip to content

Instantly share code, notes, and snippets.

@SwiftedMind
SwiftedMind / route.tsx
Created November 11, 2023 17:29
Request Validation in Next.js
import { ZodError, z } from "zod";
interface RequestBody {
name: string;
}
const RequestBody = z.object({
name: z.string(),
});
@JPvRiel
JPvRiel / bash_history_to_syslog.md
Last active May 13, 2024 04:16
Notes on (ab)using bash history to record commands to syslog

Logging bash history to syslog

Overview

Bash history was a convenience feature to help a user recall previous commands and not intended to meet any security requirements.

The Linux audit system (or alternate kernel level audit OS facility) is a more robust way to ensure user and process log events are recorded.

Security issues with bash history files and $BASH_COMMAND

@PSJoshi
PSJoshi / bash_history_syslog.txt
Created November 20, 2017 07:00
Send bash history to syslog
# Increase history size
export HISTSIZE=5000
# In the command below - every time a new prompt is issued (ie whenever you get through running a command), first the history is appended to the file, then it is cleared from the current shell's memory, then the current shell reloads the history from the file.
#export PROMPT_COMMAND="history -a; history -c; history -r; ${PROMPT_COMMAND}"
It is easy to export bash commands to syslog which can be centralized and analyzed.
Add the following lines to bashrc.
[root@psj]# vim /etc/bashrc
@unoexperto
unoexperto / patch_apk_for_sniffing.md
Last active May 13, 2024 04:15
How to patch Android app to sniff its HTTPS traffic with self-signed certificate

How to patch Android app to sniff its HTTPS traffic with self-signed certificate

  • Download apktool from https://ibotpeaches.github.io/Apktool/
  • Unpack apk file: java -jar /home/expert/work/tools/apktool.jar d net.flixster.android-9.1.3@APK4Fun.com.apk
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
@deuterium7
deuterium7 / test_app.md
Last active May 13, 2024 04:14
Тестовое задание, Laravel

Тестовое задание по Laravel

16.10.2017:

Читаю "Разобраться с основами git и git-flow"

  • зачем нужны ветки ? (для возможности работы с отдельным частями проекта)
  • какие бывают ветки ? (master: по-умолчанию, develop и другие вспомогательные ветки)
  • зачем нужен .gitignore ? (для исключения из git'а файлов и папок, чтобы исключить конфликты при слиянии веток)
  • какие проблемы за нас решает git-flow и почему стоит его использовать ? (git-flow автоматизирует процесс управления версиями и приводит систему к общепринятой модели управления версиями)
  • что будет если не писать сообщения к комитам ? (тяжело будет разобраться в каком состоянии находится проект и какие правки были введены)

Читаю о тестировании

  • unit testing (необходимо для тестирования отдельных модулей системы, как-правило это какие-то классы или объединенные участки кода имеющие общую цель)
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 13, 2024 04:08
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@crpietschmann
crpietschmann / KeepAwake.ps1
Last active May 13, 2024 04:07
PowerShell Script to Keep PC Awake
## KeepAwake.ps1
## Use SendKeys to toggle the Scroll Lock key
##
## This will keep the PC awake and prevent
## it from going to sleep.
##
## Author: Chris Pietschmann (https://build5nines.com)
$timerseconds = 60 * 4 ## Every 4 minutes
@thinkycx
thinkycx / thinkycx-zsh.sh
Last active May 13, 2024 04:02
install zsh with one script ( Ubuntu/CentOS/macOS)
#!/bin/bash
# author: thinkycx
# date: 2018-04-30
# update: 2020-07-07
# 20230520 fix zsh-autosuggestions clone bug
# usage:
# curl -fsSL https://gist.githubusercontent.com/thinkycx/2e21c3572a8d1fde21aad07a58fcf940/raw/ -o zsh.sh && sudo bash zsh.sh
#
# install zsh for one script
# support ubuntu & centos & macOS
@AntouanK
AntouanK / readme.md
Created June 23, 2015 08:24
The Art of Command Line