Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hacker1024's full-sized avatar
🎵
Working on my music app, Epimetheus.

hacker1024

🎵
Working on my music app, Epimetheus.
  • Melbourne, Australia
  • 17:38 (UTC +10:00)
View GitHub Profile
@hacker1024
hacker1024 / nvidia-gpu-sensor.pl
Last active December 8, 2023 10:33
KDE KSysGuard NVIDIA GPU temperature/memory/utilization sensor, based on @frantic1048's script, but with units and total memory detection.
#!/usr/bin/perl -w
# act as a KSysGuard sensor
# provides NVIDIA GPU info via `nvidia-settings`
# Usage (e.g. add gpu temperature sensor)
# 1. save this file, make sure it has a exec permission
# 2. in KSysGuard's menu, open `File` -> `Monitor Remote Machine`
# 3.1 in new dialog, type `Host` whatever you want
# 3.2 set `Connection Type` to `Custom command`
@hacker1024
hacker1024 / settings_section_title.dart
Last active January 26, 2021 04:34
Material settings section title widget for Flutter.
import 'package:flutter/material.dart';
class SettingsSectionTitle extends StatelessWidget {
final String title;
const SettingsSectionTitle({
Key? key,
required this.title,
}) : super(key: key);
@hacker1024
hacker1024 / segmented_control_form_field.dart
Created March 5, 2019 07:39
A simple segmented control form field for flutter.
import 'package:flutter/material.dart';
class SegmentedControlFormField extends FormField<int> {
final List<String> options;
final double textScaleFactor;
SegmentedControlFormField({
this.options,
this.textScaleFactor,
FormFieldSetter<int> onSaved,
#!/usr/bin/env python2
#This script finds the compressed data embedded in a Dell BIOS update program
#and decompresses it to an apparent HDR file. The main data seems to start
#at offset 0x58 in the HDR FWIW
import zlib
import sys
import re
check if exist
/dev/anbox-binder
if it doesn't, anbox-binder don't work
sudo apt install anbox-ubuntu-touch
sudo wget -q --show-progress -O /home/phablet/anbox-data/android.img http://cdimage.ubports.com/anbox-images/android-armhf-64binder.img
touch /home/phablet/anbox-data/.enable
chmod -R o+wrx /home/phablet/anbox-data/data
check if exist
/dev/anbox-binder
if it doesn't, anbox-binder don't work
sudo apt install anbox-ubuntu-touch
sudo wget -q --show-progress -O /home/phablet/anbox-data/android.img http://cdimage.ubports.com/anbox-images/android-armhf-64binder.img
touch /home/phablet/anbox-data/.enable
chmod -R o+wrx /home/phablet/anbox-data/data
@hacker1024
hacker1024 / blowfish.dart
Last active April 30, 2021 00:59
This is a Dart implementation of the Blowfish ECB encryption algorithm, translated from Python.
import 'dart:typed_data';
// Adapted from https://github.com/pithos/pithos/blob/master/pithos/pandora/blowfish.py
class BlowfishException implements Exception {
final dynamic message;
BlowfishException(this.message);
}
@hacker1024
hacker1024 / custom_context_menu.dart
Created August 24, 2020 05:51
A mixin to provide convenience methods to record a tap position and show a popup menu - based on https://stackoverflow.com/a/63555370/13458266
import 'package:flutter/material.dart' hide showMenu;
import 'package:flutter/material.dart' as material show showMenu;
/// A mixin to provide convenience methods to record a tap position and show a popup menu.
mixin CustomPopupMenu<T extends StatefulWidget> on State<T> {
Offset _tapPosition;
/// Pass this method to an onTapDown parameter to record the tap position.
void storePosition(TapDownDetails details) => _tapPosition = details.globalPosition;
@hacker1024
hacker1024 / caddy_json_systemd_override.conf
Last active October 1, 2020 05:41
Caddy 2 systemd service override to load a JSON configuration file
[Service]
ExecStart=
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile.json
ExecReload=
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile.json
@hacker1024
hacker1024 / aaatest.dart
Created October 11, 2020 12:17
An IntelliJ IDEA live template for Dart testing implementing Reso Coder's "Arrange, Act, Assert" structure
test(
'should $TITLE$',
() async {
// Arrange
$ARRANGE$
// Act
$ACT$
// Assert