Skip to content

Instantly share code, notes, and snippets.

View StefanScherer's full-sized avatar
🌍

Stefan Scherer StefanScherer

🌍
View GitHub Profile
@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
@jboner
jboner / latency.txt
Last active May 8, 2024 16:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@joefitzgerald
joefitzgerald / sysprep-and-seal.ps1
Created August 17, 2013 00:19
Sysprep And Remove Vagrant User
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SysprepAndSeal" -ErrorAction SilentlyContinue
$ObjUser = [ADSI]"WinNT://localhost/vagrant";
$ObjUser.userflags = 2;
$ObjUser.setinfo();
C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /quiet /shutdown
{
"device_name": "My Book Live NAS",
"listening_port" : 0, // 0 - randomize port
"storage_path" : "/DataVolume/cache/btsync/syncStorage",
"pid_file" : "/var/run/btsync.pid",
"check_for_updates" : true,
"use_upnp" : true, // use UPnP for port mapping
@martijnvermaat
martijnvermaat / raspberry-pi-config.md
Last active February 3, 2023 01:53
Notes on my Raspberry Pi server config

Notes on my Raspberry Pi server config

This describes how I installed and configured my Raspberry Pi model B (512MB).

The Pi is mainly used as SSH jump host, IRC client, Git server, backup fileserver, etc. It doesn't need stellar performance, it just has to be cheap, low in power usage, and secure.

Raspbian on encrypted root

@adamstac
adamstac / gist:8347083
Last active November 29, 2017 00:55
Enable HiDPI mode on a VMware Fusion OS X 10.9 Mavericks Vagrant VM
  1. Set "Use full resolution for Retina display" in the VM's Settings > Display
  2. Run this command in Terminal sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled -bool true
  3. In System Preferences, set the display to "scaled" using the resolution 1292 x 807 (HiDPI)
  4. Enjoy.
@jtopper
jtopper / gist:8588263
Last active October 7, 2021 08:06
Add a new disk to a VMWare vagrant box
config.vm.provider :vmware_fusion do |vm|
vdiskmanager = '/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager'
dir = "#{ENV['HOME']}/vagrant-additional-disk"
unless File.directory?( dir )
Dir.mkdir dir
end
@cameron
cameron / docker-ssl-cert-generate
Last active February 2, 2023 10:09
Generate self-signed SSL certs for docker client <— HTTPS —> daemon
#! /bin/bash
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem
openssl genrsa -des3 -out server-key.pem
openssl req -new -key server-key.pem -out server.csr
@mchow01
mchow01 / mongodb_injection_nodejs.txt
Last active December 12, 2021 23:27
MongoDB Request Injection Attack in Node.js + Express Web Applications
Overview
========
Students in my Web Programming class (G. Brown, S. Prassad, et al)
discovered that MongoDB request injection attacks also work on Node.js
+ Express web applications. MongoDB request injection attacks have
been known for PHP web applications.
Impact
======
Attacker can view and download all the data in a MongoDB database
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all