Skip to content

Instantly share code, notes, and snippets.

@timnew
timnew / Rename.ps1
Last active March 15, 2024 13:49
Script to Rename Computer without Reboot
$ComputerName = "New Name"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname"
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\Computername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Computername\ActiveComputername" -name "Computername" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname" -value $ComputerName
Set-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -name "AltDefaultDomainName" -value $ComputerName
@sennajox
sennajox / run_fio.sh
Last active December 21, 2023 11:00
A script that runs fio test and genearates a simple result for each jobs
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev output_dir [iodepth]"
echo "example 1: Testing the whole block device. Attention: That will destory the filesystem on the target block device"
echo "./run_fio.sh /dev/sdb fio_test"
echo ""
echo "example 2: Testing a file, but not destory filesystem. Suppose the target device mount on /data"
echo "fallocate -l 1G /data/test.dat"
echo "./run_fio.sh /data/test.dat fio_test"
@itsmattsoria
itsmattsoria / gistfil1.textile
Last active May 15, 2024 17:54
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@yiboyang
yiboyang / git_bash_here.ahk
Last active March 3, 2024 08:44
Git bash here in Windows Explorer with Ctrl + Alt + T
;
; AutoHotkey Version: 1.1
; Language: English
; Platform: Win9x/NT
; Author: Yibo
;
; Script Function:
; Define the shortcut Ctrl + Alt + T for launching Git bash in current folder in Windows Explorer
;
@vrendina
vrendina / adb-screen
Created June 24, 2017 22:29
Turn the screen on or off on all connected Android devices
#!/bin/sh
# Returns the power state of the screen 1 = on, 0 = off
getDisplayState() {
state=$(adb -s $1 shell dumpsys power | grep mScreenOn= | grep -oE '(true|false)')
# If we didn't get anything it might be a pre-lollipop device
if [ "$state" = "" ]; then
state=$(adb -s $1 shell dumpsys power | grep 'Display Power' | grep -oE '(ON|OFF)')
fi
@Pulimet
Pulimet / AdbCommands
Last active May 15, 2024 20:41
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@probonopd
probonopd / orangepizero.md
Last active December 27, 2023 09:27
Orange Pi Zero

Orange Pi Zero

Ideas

  • Port HomeServer to it
  • Read-only thanks to overlayroot
  • Native serial for Viessmann w/o USB-to-Serial
  • Native 433 MHz sending w/o Arduino
  • Native Audio output w/o USB dongle; can attach small amp board
  • Webcam via USB with motion
@dmitriysafronov
dmitriysafronov / pve-setup.sh
Last active April 25, 2024 06:12
PVE customisation
## Step 1: Storage
#pvesm remove local-lvm
#lvremove /dev/pve/data -y
#lvcreate -n vz -l 100%FREE pve
#mkfs.ext4 -L vz /dev/pve/vz
#mount | grep -q -w '/dev/pve/vz' || mount /dev/pve/vz /var/lib/vz
#grep -q -w '/dev/pve/vz /var/lib/vz ext4 defaults,lazytime,commit=60,errors=remount-ro 0 2' /etc/fstab || echo '/dev/pve/vz /var/lib/vz ext4 defaults,lazytime,commit=60,errors=remount-ro 0 2' >> /etc/fstab
## Step 2: Free repository
rm -f /etc/apt/sources.list.d/pve-enterprise.list
@pauloxnet
pauloxnet / README.md
Created November 14, 2017 16:34 — forked from zhiguangwang/README.md
Building Unreal Engine Game Client and Dedicated Server on Linux.

Building Unreal Engine Game Client and Dedicated Server on Linux

Because the build tools of UE4 works across platforms (Windows, Mac OS, Linux), steps in this article can be applied to Mac OS and Windows as well.

On Windows, You need to replace RunUAT.sh with RunUAT.bat though.

Prerequisites

First, get Unreal Engine 4 sourcecode and export the following environment variables:

@i3v
i3v / cdm_fio.sh
Last active May 15, 2024 13:10
Reproducing CrystalDiskMark tests with fio - fixes for https://unix.stackexchange.com/revisions/480191/9
#!/bin/bash
# This script is based on https://unix.stackexchange.com/revisions/480191/9 .
# The following changes proved to be necessary to make it work on CentOS 7:
# * removed disk info (model, size) - not very useful, might not work in many cases.
# * using "bw" instead of "bw_bytes" to support fio version 3.1 (those availible through yum @base)
# * escaping exclamation mark in sed command
# * the ".fiomark.txt" is not auto-removed
LOOPS=5 #How many times to run each test