Skip to content

Instantly share code, notes, and snippets.

@guss77
guss77 / powerdraw
Last active March 8, 2024 13:43
Show total current power draw of the PC on Linux, using powercap
#!/bin/bash
#
# Installation:
# 1. put this script somewhere in your path - `/usr/local/bin/powerdraw` is probably
# a good idea.
# 2. Give the script execution permissions, e.g. `sudo chmod a+x /usr/local/bin/powerdraw`
# 3. Optional - add a sudoers file to allow users to execute this file without typing their
# password over and over. For example, create `/etc/sudoers.d/allow-powerdraw` with the
# following content:
# %admin ALL = NOPASSWD: /usr/local/bin/powerdraw, /usr/local/bin/powerdraw -f
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
(originally written in 2009 and posted to livejournal! https://jdimpson.livejournal.com/6812.html
The last article teaches how to use socat by comparing it first to cat then to netcat. It skimped on socat's UDP-related features, because netcat only implements a subset of them. This article picks up where the last one left off, with respect to UDP. After this article will be one more that discusses advanced socat features.
It turns out there are a lot of subleties when dealing with UDP, even before multicast is mixed in. We'll abandon the comparisons to netcat, as we've exceeded what netcat can do. But first a quick reminder of one way socat does UDP.
socat as a UDP server on port 11111.
socat STDIO UDP-LISTEN:11111
@smoser
smoser / README.md
Last active May 2, 2024 09:23
qemu to linux mapping of smbios / dmi information

Mappings for DMI/SMBIOS to Linux and dmidecode

Information can be put into dmi tables via some qemu-system hosts (x86_64 and aarch64). That information is exposed in Linux under /sys/class/dmi/id and can be read with dmidecode. The names are very annoyingly inconsistent. The point of this doc is to map them.

Mappings

Example qemu cmdline:

qemu-system-x86_64 -smbios type=<type>,field=value[,...]

qemu-system-x86_64 -smbios type=0,vendor=superco,version=1.2.3
@mareku
mareku / youtube_channel_rss
Created March 14, 2018 00:33
youtube user and channel rss Bookmarklet
javascript:void(function(t){prompt('channel RSS URL','https://www.youtube.com/feeds/videos.xml?channel_id='+t[1])})(location.href.match(/https?:\/\/www.youtube.com\/channel\/([^/?]+)/));
@johncf
johncf / mui2-custompage-nsd.nsi
Last active August 29, 2023 06:28
NSIS Example using MUI2 with a custom page built with NsDialogs.
!include nsDialogs.nsh
!include LogicLib.nsh
!include MUI2.nsh
Name nsDialogs
OutFile nsDialogs.exe
RequestExecutionLevel user
ShowInstDetails show
Var Dialog

WannaCry|WannaDecrypt0r NSA-Cyberweapon-Powered Ransomware Worm

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: All Windows versions before Windows 10 are vulnerable if not patched for MS-17-010. It uses EternalBlue MS17-010 to propagate.
  • Ransom: between $300 to $600. There is code to 'rm' (delete) files in the virus. Seems to reset if the virus crashes.
  • Backdooring: The worm loops through every RDP session on a system to run the ransomware as that user. It also installs the DOUBLEPULSAR backdoor. It corrupts shadow volumes to make recovery harder. (source: malwarebytes)
  • Kill switch: If the website www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com is up the virus exits instead of infecting the host. (source: malwarebytes). This domain has been sinkholed, stopping the spread of the worm. Will not work if proxied (source).

update: A minor variant of the viru

@kleo
kleo / android-ssh-server
Last active April 4, 2023 02:31
GNURoot Debian Jessie Android SSH Server
# GNURoot Debian Jessie Android SSH Server
# Google Play Store: https://play.google.com/store/apps/details?id=com.gnuroot.debian
# Github: https://github.com/corbinlc/GNURootDebian
# change root password
passwd
apt update
apt install -y nano
@DonnchaC
DonnchaC / huaiwei-unlock.py
Created September 24, 2016 19:27
Huaiwei unlock code generator - Based on the disassembler generated C code in https://github.com/forth32/huaweicalc
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import hashlib
import argparse
import binascii
import struct
def encrypt_v1(imei, key):