Skip to content

Instantly share code, notes, and snippets.

// Consumer usage
class MyFragment : Fragment(R.layout.my_fragment) {
private val viewModel: MyViewModel by viewModels()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val consumer = consumeState(viewModel)
}
}
@klezVirus
klezVirus / EtwStartWebClient.cs
Last active April 27, 2024 16:55
A PoC in C# to enable WebClient Programmatically
using System.Runtime.InteropServices;
using System;
/*
* Simple C# PoC to enable WebClient Service Programmatically
* Based on the C++ version from @tirannido (James Forshaw)
* Twitter: https://twitter.com/tiraniddo
* URL: https://www.tiraniddo.dev/2015/03/starting-webclient-service.html
*
* Compile with:
@HarmJ0y
HarmJ0y / PowerView-3.0-tricks.ps1
Last active April 27, 2024 16:56
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here: http://www.harmj0y.net/blog/powershell/make-powerview-great-again/
# tricks for the 'old' PowerView are at https://gist.github.com/HarmJ0y/3328d954607d71362e3c
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set
@crundberg
crundberg / gist:a77b22de856e92a7e14c81f40e7a74bd
Last active April 27, 2024 16:51
Setup deCONZ on unprivileged Proxmox container

Setup deCONZ on unprivileged Proxmox container

Preparation on host

First find your Conbee with lsusb and note the ID. The vendor is 1cf1 and the product is 0030.

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 1cf1:0030 Dresden Elektronik ZigBee gateway [ConBee II]
Bus 001 Device 003: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
@bitsurgeon
bitsurgeon / nvidia.md
Last active April 27, 2024 16:48
install Nvidia driver on Ubuntu with Secure Boot

Install Nvidia Driver on Ubuntu 18.04.3

Secure Boot

This section applies to machines with Secure Boot, such as ThinkPad.

  1. Before installation, switch to "Discrete Graphics" in BIOS, if both Intel and Nvidia graphics are present.
  2. During installation, make sure to select the "Install third-party software for graphics and Wi-Fi hardware and addition media formats" in "Updates and other software" screen.
  3. Select "Configure Secure Boot", and set password.
  4. Continue Ubuntu installation as normal.
@JoveYu
JoveYu / lenovo-fn-q.sh
Last active April 27, 2024 16:45
Linux Lenovo Fn+Q Power Mode Script
#!/bin/bash
ACPI_BALANCE="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x000FB001"
ACPI_POWER="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001"
ACPI_ECO="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001"
ACPI_MODE="\_SB.PCI0.LPC0.EC0.SPMO"
MODE=$(sudo sh -c "echo '$ACPI_MODE' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call")
MODE=${MODE:2}
TARGET=$(((MODE+1)%3))
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 16:45
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@diego3g
diego3g / settings.json
Last active April 27, 2024 16:43
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {