Skip to content

Instantly share code, notes, and snippets.

View markusressel's full-sized avatar
🤓
Just coding.

Markus Ressel markusressel

🤓
Just coding.
View GitHub Profile
@markusressel
markusressel / esphome_hx711_smart_scale.yaml
Last active March 12, 2024 05:05
ESPHome sample configuration for an HX711 powered Smart Scale including Auto-Tare functionality.
Moved to https://github.com/markusressel/ESPHome-Smart-Scale
@erdnuesse
erdnuesse / pc-keyboard-ger.keylayout
Created February 13, 2020 18:23
Deutsches Keyboardlayout für Windows Tastaturen auf OSX.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<keyboard group="0" id="4711" name="Win DE" maxout="1">
<layouts>
<layout first="0" last="17" modifiers="Modifiers" mapSet="ANSI"/>
<layout first="18" last="18" modifiers="Modifiers" mapSet="JIS"/>
<layout first="21" last="23" modifiers="Modifiers" mapSet="JIS"/>
<layout first="30" last="30" modifiers="Modifiers" mapSet="JIS"/>
<layout first="33" last="33" modifiers="Modifiers" mapSet="JIS"/>
<layout first="36" last="36" modifiers="Modifiers" mapSet="JIS"/>

tldr: go build only produces an executable for main packages. Check the package name of your main file is main.

I am an idiot. Its only through mistakes that you learn tho. I have recently been running into issues with my new golang projects. ONLY the new ones. Whenever I try to make a new project, it would always have issues. The biggest issue is the fact that "go build" would not produce an executable without "-o main.exe" as arguments. When an executable was produced, if I ran it I got

$ ./main.exe
./main.exe: line 1: syntax error near unexpected token \`newline\'
./main.exe: line 1: \`!<arch>\'
@negz
negz / kubedump.sh
Last active March 6, 2024 18:42
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@narate
narate / create-hotspot.md
Last active April 15, 2024 14:22
Create Wi-Fi Hotspot on Linux using nmcli

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
@mg6maciej
mg6maciej / MoshiExtensions.kt
Created May 6, 2017 10:07
Moshi generic type adapters
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import java.lang.reflect.Type
// val adapter = moshi.listAdapter<MyModel>()
// val adapter = moshi.mapAdapter<String, List<MyModel>>(valueType = listType<MyModel>())
inline fun <reified E> Moshi.listAdapter(elementType: Type = E::class.java): JsonAdapter<List<E>> {
return adapter(listType<E>(elementType))
@JoachimL
JoachimL / barcodereader.py
Last active November 8, 2022 07:33
Python USB barcode reader
import evdev
from evdev import *
from azure.storage.queue import QueueService, QueueMessageFormat
import threading
import time
from queue import *
import datetime
# responsible for uploading the barcodes to the azure storage queue.
class BarcodeUploader:
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@ethack
ethack / TypeClipboard.md
Last active May 6, 2024 03:41
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.

@catehstn
catehstn / AndroidOneColorImage.java
Last active September 25, 2023 09:16
Android create one color image
/**
* A one color image.
* @param width
* @param height
* @param color
* @return A one color image with the given width and height.
*/
public static Bitmap createImage(int width, int height, int color) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);