Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete Boxes</title>
<style>
.box {
width: 100px;
height: 100px;
@crowsonkb
crowsonkb / resample.py
Last active May 13, 2024 04:33
Good differentiable image resampling for PyTorch.
"""Good differentiable image resampling for PyTorch."""
from functools import update_wrapper
import math
import torch
from torch.nn import functional as F
def sinc(x):
@franksacco
franksacco / session-handler-life-cycle.md
Last active May 13, 2024 04:32
A complete overview of PHP session handler life cycle

A complete overview of PHP session handler life cycle

The purpose of this document is to provide a complete overview of the PHP session handler life cycle updated to version 7.0 or above. In particular, I want to emphasize what methods and in what order are called when the native PHP functions are used for session management.
I created this document because the information on the web and the official documentation are very superficial on this topic, in particular on what concerns the implementation of a safe and stable session handler.

@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.