Skip to content

Instantly share code, notes, and snippets.

@eXenon
eXenon / scapy_bridge.py
Last active May 12, 2024 03:00
Use scapy as a modifying proxy
#!/usr/bin/python2
"""
Use scapy to modify packets going through your machine.
Based on nfqueue to block packets in the kernel and pass them to scapy for validation
"""
import nfqueue
from scapy.all import *
import os
@c22dev
c22dev / DEPSteps.md
Last active May 12, 2024 02:58
Remove MDM & DEP from an Apple Sillicon Mac (Sonoma)

How to make an MDM Mac shine like it's brand new ?

Works, as of 14/04/2024, on macOS 14.4.1 and lower (prob higher but idk)

This was made for Apple Sillicon Macs.

Restore Process

You need another Mac for this.

If you don't have one and have recovery locked, it's not possible.

@vijay-prema
vijay-prema / ubuntu-on-asus-g14.md
Last active May 12, 2024 02:56
Ubuntu on Asus ROG Zephyrus G14 2021

Ubuntu on Asus ROG Zephyrus G14 2021 (Setup guide)

Here is a way to do a robust install of Ubuntu (+ optional Windows 11 dual boot and LUKS encryption) on an Asus laptop, with minimal usable hardware support, without a significant amount of tinkering that may break in future or require frequent technical attention.

In summary, the key thing is to have an up to date kernel, which usually means disabling secure-boot and installing the latest stable (6.0+) using mainline or xanmod, and as well as making sure the latest nvidia driver and dkms is installed.

Specs:

  • Model Asus G14 2021 (GA401QC)
  • AMD R7 5800 8 core 16 thread (onboard Radeon graphics)
  • NVIDIA RTX 3050 4GB (60W +15W boost)
@goliatone
goliatone / README.md
Last active May 12, 2024 02:52 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@monokh
monokh / uniswap-sdk-v2-get-price.js
Last active May 12, 2024 02:51
Uniswap V2 SDK Get Price
const { Token, WETH9, CurrencyAmount, TradeType } = require('@uniswap/sdk-core')
const { Route, Trade, Pair } = require('@uniswap/v2-sdk')
const ethers = require('ethers')
;(async () => {
const CHAIN_ID = 1
const daiAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F'
const tokenA = WETH9[CHAIN_ID]
const tokenB = new Token(CHAIN_ID, daiAddress, 18, 'DAI', 'DAI')
const pairAddress = Pair.getAddress(tokenA, tokenB)
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 12, 2024 02:47
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active May 12, 2024 02:46
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@michael-pratt
michael-pratt / RequestAndResponseLoggingFilter.java
Last active May 12, 2024 02:45
Simple Spring Boot Request and Response Logging Filter
// Adapted from https://gist.github.com/int128/e47217bebdb4c402b2ffa7cc199307ba
package com.elvtn.logging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
@zhuziyi1989
zhuziyi1989 / URL Schemes.md
Last active May 12, 2024 02:45
常用 URL Schemes 收集。

** 由于此文年事已久,可能某些URL Schemes已失效,可在评论区留言指出!(最后更新于 2024.4.16)

关于 URL Scheme 你知道多少?

iOS系统中

由于苹果的各应用都是在沙盒中,不能够互相之间访问或共享数据。但是苹果还是给出了一个可以在APP之间跳转的方法:URL Scheme。简单的说,URL Scheme就是一个可以让 APP 相互之间可以跳转的协议。每个 APP 的URL Scheme都是不一样的,如果存在一样的URL Scheme,那么系统就会响应先安装那个 APP 的URL Scheme,因为后安装的 APP 的URL Scheme被覆盖掉了,是不能被调用的。

Android系统中

@siph
siph / building_a_standalone_nixvim.md
Created September 10, 2023 23:51
Building a standalone nixvim configuration

Building a standalone nixvim configuration

A standalone configuration is one that exists in its own project/repository. This means that you can externalize your entire neovim configuration, including flake inputs, nixpkgs version, etc...

This decoupling of neovim and NixOS configurations has multiple advantages including mixing stable/unstable nixpkgs and the ability to run your neovim configuration outside of your NixOS configuration. You can even run it outside of NixOS all together.