Skip to content

Instantly share code, notes, and snippets.

@Sh4yy
Sh4yy / clx.go
Created April 25, 2024 20:39
Generate CLI commands for common tasks.
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"os"
"runtime"
@CybersamuraiDK
CybersamuraiDK / wifi-passwords.ps1
Created October 3, 2020 17:18 — forked from willjobs/wifi-passwords.ps1
PowerShell script to show all wifi passwords saved in Windows
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize
@groue
groue / ObservableState.swift
Last active April 26, 2024 07:50
WithBindable
import SwiftUI
/// Supplies an observable object to a view’s hierarchy.
///
/// The purpose of `WithBindable` is to make it possible to instantiate
/// observable objects from environment values, while keeping the object
/// alive as long as the view is rendered.
///
/// For example:
///
@andrew-raphael-lukasik
andrew-raphael-lukasik / .UIDocumentLocalization.cs.md
Last active April 26, 2024 07:50
Text localization script for UIDocument (UI Toolkit @ Unity)

pattern to follow

// NOTE: this class assumes that you designate StringTable keys in label fields (as seen in Label, Button, etc) // and start them all with '#' char (so other labels will be left be)

@alphazo
alphazo / gist:3303282
Created August 9, 2012 11:03
Clone MiFare cards using chinesse UUID writable cards

libnfc supports UUID writable cards and even has some dedicated tools for them.

However it doesn't work with some of the cards found on eBay that are even simpler to use. Sector 0 is unlocked and can be written without any additional commands. libnfc requires a small patch to get it working.

Following has been tested under ArchLinux with modified libnfc 1.5.1, mfoc 0.10.2 and a SCL3711 dongle.

Patch & recompile libnfc

The patch is fairly simple, open libnfc-1.5.1/utils/nfc-mfclassic.c and comment 2 lines (it was lines 384 and 385 for me):

// Try to write the trailer

@markahesketh
markahesketh / cell_component.rb
Created April 25, 2024 13:43
ViewComponent Table Example
class Admin::DataTable::CellComponent < ApplicationComponent
def initialize(tag: :td, header: false, collapse: false, padding: true, numeric: false, centered: true, **args)
@args = args
@args[:tag] = tag
@args[:class] = class_names(
@args[:class],
"text-end" => numeric,
"w-1" => collapse,
"text-center" => centered,
@ELI7VH
ELI7VH / react-context-boilerplate.tsx
Last active April 26, 2024 07:48
React Context Boiler Plate - Typescript
import React, { createContext, useContext, useState, useEffect } from "react"
type Props = {
children: React.ReactNode
}
type Context = {
count: number
increment: () => void
}
@dlxotn216
dlxotn216 / Auditing.md
Last active April 26, 2024 07:48
Spring data jpa의 Audit 기능과 Spring data envers

Application을 구현하면서 대부분 요구사항에 명시되는 기능이 변경사항 추적이다. 이때 변경 사항을 추적하기 위해 필요한 데이터는 누가 언제 생성하였으며, 누가 언제 변경하였는지 그리고 해당 데이터의 시점에 따른 변경 이력이다.

전통적인 Mybatis를 이용하는 Spring MVC와 같은 프레임워크에선 AOP를 이용한다던지 또는 Mapper에서 Insert, Update, Delete 쿼리를 실행할 때마다 History table에 Insert하는 쿼리를 같이 실행 하도록 처리하는 등의 방법이 있다. 이러한 방법을 사용할 때 생각보다 개발 일정을 지연시키는 요소가 많다.

예를들어 History 테이블의 PK를 잘못 지정하여 발생하는 예외나 DBMS마다 상이한 다량의 쿼리문 실행 문법 등이다. 전자는 개발 단계보다 UAT 기간 등에서 발견하기 쉬울 뿐더러 모든 대상 테이블을 돌면서 Schema를 변경해야 하는 번거로움이 있다.

@tstellanova
tstellanova / rpi0_rust_env.md
Last active April 26, 2024 07:47
Install rust development environment on Raspberry Pi Zero W (rpi0w)

Purpose

Setup your Raspberry Pi 0 w to develop with the Rust language.

Initial configuration

  • Ensure your rpi0 has a network connection so it can download and install packages
  • Install Raspbian based on Debian Stretch

Configure pigpio

If you're working with the rpi0's GPIO, the pigpio library can be very handy.

@zmts
zmts / tokens.md
Last active April 26, 2024 07:47
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов