Skip to content

Instantly share code, notes, and snippets.

View dungsaga's full-sized avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / reclaim-disk-space.md
Last active March 26, 2022 04:53
clean up and reclaim disk space

Apps can leave lots of unused files behind, such as huge dump files, lots of log files. Let's clean them up and reclaim some disk space.

We can use a disk usage analyzer such as WizTree (which is very fast on NTFS disk since it reads from $MFT).

  • Desktop Central
    • C:\Program Files (x86)\DesktopCentral_Agent\logs\
    • C:\Program Files (x86)\DesktopCentral_Agent\logs\Dump\
    • C:\Program Files (x86)\DesktopCentral_Agent\USB\Record\ (here's the home for thousands of extremely long file names)
  • Dell Command Update
@dungsaga
dungsaga / bloated-git-tools.md
Last active March 24, 2022 03:51
Bloated git tools

Git has deep root in Linux scripting. Many git tools for Windows/Mac decided to include the git tools in their own package and thus became bloated.

SmartGit 20.2.4 (2021-03-08) is an extremely not-so-smart example:

  • In git/libexec/git-core and git/bin, it has 130 identical files.
  • Each file is 17MB (17929104). That's 2.17GB (2330783520) just for clones of the git binary.

UPDATE: It's not their fault for 2.17GB of duplicated files. It's my fault. I must have extracted the SmartGit package with some unpacker that does not understand hard links (or I might copied/extracted it from Windows to the WSL disk). The SmartGit package (smartgit-linux-20_2_6.tar.gz) used hard links for duplicated files and it should not take too much space as I incorrectly reported.

Compare that to the included JRE (in jre) which is only 54.5 MB. Compare that to the main code (in lib) which is also 54.4 MB (along with third party code, this includes smartgit.jar which is only 21.3MB).

@dungsaga
dungsaga / Clear-WindowsInstallerPatchInfo.ps1
Created March 24, 2022 06:13 — forked from JohnLBevan/Clear-WindowsInstallerPatchInfo.ps1
Clear-WindowsInstallerPatchInfo; cleanly/safely remove files from c:\windows\installer
#based on
# - http://blogs.msdn.com/b/heaths/archive/2007/01/31/how-to-safely-delete-orphaned-patches.aspx
# - http://www.bryanvine.com/2015/06/powershell-script-cleaning-up.html
# - https://p0w3rsh3ll.wordpress.com/2012/01/10/working-with-the-windowsinstaller-installer-object/
clear-host
function Get-WindowsInstallerPatchInfo {
[CmdletBinding()]
Param ()
@dungsaga
dungsaga / how-to-build-HeidiSQL.md
Created April 25, 2022 22:39
How to build HeidiSQL
@dungsaga
dungsaga / DNS_TO_LOCALHOST.markdown
Created May 17, 2022 03:10 — forked from tinogomes/DNS_TO_LOCALHOST.markdown
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

It turns out that some kind hearted people already set up wildcard domains for you already. You can use any domain below and/or any subdomain of these and they currently resolve to 127.0.0.1 but could switch at any time to resolve somewhere else. Here's the list of ones I know about. Let me know if there are more!

  • localhost - It will always works. Do you know why? I hope so.
  • [*.]fuf.me - Managed by @fidian; it will always point to localhost for IPv4 and IPv6
  • [*.]fbi.com - 👏 👏 👏 👏 👏
  • [*.]localtest.me
  • [*.]127-0-0-1.org.uk
  • [*.]vcap.me
@dungsaga
dungsaga / gist:a828c4e29e2e477281ac26932cb9da7d
Created May 17, 2022 03:12 — forked from rubensa/gist:407de76194d27f763cd5e8bd235fdd5d
Public DNS Pointing To localhost (127.0.0.1)

Available Wildcarded DNS Domains

It turns out that some kind hearted people already set up wildcarded domains for you already. You can use any top level domain below and any subdomain of these and they will always resolve back to 127.0.0.1 (your local machine). Here's the list of ones I know about. Let me know if there are more!

  • 127-0-0-1.org.uk
  • 42foo.com
  • beweb.com
  • domaincontrol.com
  • feacebook.com
  • fuf.me - Managed by @fidian; it will always point to localhost for IPv4 and IPv6
@dungsaga
dungsaga / merge.md
Created June 10, 2022 10:00 — forked from jt/merge.md
Merge a forked gist

If someone forks a gist and you'd like to merge their changes. Do this:

  1. clone your repo, I use the name of the gist

     git clone git://gist.github.com/1163142.git gist-1163142
    
  2. add a remote for the forked gist, I'm using the name of my fellow developer

     git remote add aaron git://gist.github.com/1164196.git
    
@dungsaga
dungsaga / clean-up-url.js
Created July 4, 2022 07:34
clean up Youtube URLs
// remove "pp=" from query string of all "href" in a Youtube page
for (a of document.getElementsByTagName('a')) { a.setAttribute('href', a.getAttribute('href')?.replace(/&pp=.+/, '')) }
#Original command that was run
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -NonInteractive -NoProfile -Command "& {function Run-Server() { param([string]$h); $b = New-Object byte[] 8; $p = New-Object System.IO.Pipes.AnonymousPipeClientStream -ArgumentList @([System.IO.Pipes.PipeDirection]::In, $h); if ($p) { $l = $p.Read($b, 0, 8); while ($l -gt 7) { $c = [System.BitConverter]::ToInt32($b, 0); $l = [System.BitConverter]::ToInt32($b, 4); $t = $null; if ($l -gt 0) { $t1 = New-Object byte[] $l; $l = $p.Read($t1, 0, $t1.Length); $t = [System.Text.Encoding]::UTF8.GetString($t1, 0, $l) } if ($c -eq 1) { Invoke-Expression $t } elseif ($c -eq 9) { break } $l = $p.Read($b, 0, 8) } $p.Dispose() } } Run-Server -h 1860}"
#Deobfuscated command
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -NonInteractive -NoProfile -Command
# & is similar to Invoke-Expression except it will create an additional scope
& {
function Run-Server(){
#$h has a string value of 1860 passed from the below
@dungsaga
dungsaga / clojure-beginner.md
Created November 9, 2022 07:55 — forked from yogthos/clojure-beginner.md
Clojure beginner resources

Introductory resources