Skip to content

Instantly share code, notes, and snippets.

View timnew's full-sized avatar

TimNew timnew

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
@timnew
timnew / All
Last active February 3, 2024 06:47
Factorio Blueprint
0eNrsvduSW8mxpvkqbbxmylacI2S2+6JnnmCm72RlZSQrq5QmFsnOSmpv2Ta9+wBIJLAyMxz4PwdGdRBvShJV/BHLTxHh/rvHf795//Hr7Zf7u08P37///Plvb/7838c/+eXNn//y3+Bf2P5/dx8+f3r841/ufvr07uP2zx7+8eX2zZ/f3D3c/vzm7ZtP737e/q/7d3cf3/zz7Zu7Tz/c/tebP4d/vj37Vx5u/+vhy8d3D7c3H9/d/3R788vD50+3K4z4z+/evrn99HD3cHf7uIbd//jH95++/vz+9n7zI89+/ebDX9/dfbrZ/+jbN18+/7L5m58/bX9/u6LU/lTevvnHmz/fxM1/++d2gS/w4gHvl4cN4k9/fbjZfdYEazwhzXCSjJPbKZz8/PvML8v92Ze9ffPD3f3th8d/I09wC5FbCmflVtXvTeGk3JqME0/KrWtySxHKbRxwP3y9//vtD6Z19D1qfI5ZJphh4UY3VUII4uqysbrZF4fITXm+uqStLgUiu8wNb766Iq4uEtlVbs7z1TVuImkK1FHAzOngHvGle8QZ/ODGMl1nXLhe50Boh0gRfnCMXMPzdSYaWZbnq6sz0MzNJkxXV3S9pgPQeelVGrBefHSagTZug/OP7jRgKSoZ3LCnq0u6h0SgkhRoHBRUkhxeMv/oxM57B28O/aU3hxk88Jcn4PYcts1gC4cdglQr9u4N7AyIe4wB1GWgEuYfOtvk0+Cw7by284KMqUTbmGbqyUH3dGBMObKjO3SBnPiqBVvN/Jw2N7FccCgxgPSzWQK2mhuHVWwVndtSoraqe1jabyahnLfVsnDYdn61Bd7660EYVTnTlehMKgTjclzUs902Iu2AsnCDzyponYPOrLcU5/VAlGxl8APCNwbfnynuvMTB7mZY81Tmg8MKgbyCGxRw6Ro4rODSFe5q0KVrcua7LJeuWT0mA5euxXlXFYVQ1TWDiFEbWzP0ucr2vQgjRtVvYwm4dFs4rODSLejb6dPZIp136RbV1EOc28X
@timnew
timnew / behaviors.rb
Created July 17, 2012 13:27
Rails MultiSchema utility for Postgres multi-schema database
module MultiSchema
module Behaviors
@@disable_message = false
def disable_message=(val)
@@disable_message = val
end
def disable_message
@@disable_message
@timnew
timnew / IndexedTrackingScrollController.dart
Last active January 2, 2024 13:54
Flutter Scrollable Controller which jump to given index
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:timnew_reader/features/App/common.dart';
class IndexedTrackingScrollController extends TrackingScrollController {
final GlobalKey sliverListKey = GlobalKey();
@timnew
timnew / JSONView Dark Theme.css
Created March 15, 2013 03:16
This is a dark theme for JSONView chrome extension
body {
white-space: pre;
font-family: consolas;
color: white;
background: black;
}
.property {
color: orange;
font-weight: bold;
@timnew
timnew / example.dart
Created August 2, 2023 23:53
Dart override fails due to signature conflict
abstract class A {
@override
String toString({int param = 1}) => "A:$param";
}
mixin M {
String toString() => "M";
}
class B extends A with M {
@timnew
timnew / select_sdk
Last active March 1, 2023 05:11
Activate SDK from a bunch of installed ones
#!/usr/bin/env bash
# How to use
# 1. Put all unzipped SDKs into a folder
# 2. Put this file in the same folder
# 3. Update the `SYMOLIC_LINK` value to the one reffered by $PATH
# 4. call this script from anywhere, it would list all SDKs, and recreate the $SYMOLIC_LINK to the selected SDK
SYMOLIC_LINK=~/Workspace/flutter
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
@timnew
timnew / switch_demo.dart
Created February 8, 2023 07:51
Switch demo
import 'package:flutter/material.dart';
void main() => runApp(const SwitchApp());
class SwitchApp extends StatelessWidget {
const SwitchApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
@timnew
timnew / dart.json
Created November 16, 2022 00:54
VSCode Code snippet for Dart and Flutter
{
"for": {
"prefix": "for",
"body": ["for(int ${1:i} = ${2:0}; $1 < $3; $1++){", " $4", "}"],
"description": "For loop"
},
"fore": {
"prefix": "fore",
"body": ["for(final ${1:item} in ${2: list}){", " $3", "}"],
"description": "for each"