Skip to content

Instantly share code, notes, and snippets.

View NeraSnow's full-sized avatar

Benjamin Chen NeraSnow

View GitHub Profile
@NeraSnow
NeraSnow / change dns.ps1
Created October 25, 2018 03:59
Change DNS settings
<#
Credit: https://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator
#>
# Runs as admin
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
@NeraSnow
NeraSnow / gist:056d8ea504fd1507d49858e260a5035b
Created February 22, 2019 06:46
LeetCode 2. Add Two Numbers draft
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
@NeraSnow
NeraSnow / print.sh
Last active July 14, 2019 16:44
Print all the contents under the current directory with file path
find -printf "\n%p\n\n" -exec cat {} \;
FOR /F "delims==" %%I IN ('dir /b /s "*.zip"') DO (
"C:\Program Files\7-Zip\7z.exe" x -o"%%~dpnI" "%%I"
)
/tp 31 66 126 Village
/setblock minecraft:grass_path
@NeraSnow
NeraSnow / mcMap.ps1
Last active May 6, 2021 18:53
Minecraft Custom Map
$ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) }
######## Need to modify here
Set-Variable -Name "StartIndex" -Value 299
###### Modify Above!!!!
Set-Variable -Name "EndIndex" -Value $StartIndex
Set-Variable -Name "Count" -Value 0
@NeraSnow
NeraSnow / armorStand.mcfunction
Created May 2, 2021 00:02
Minecraft Invisible Armor Stand (Floating Object)
summon armor_stand ~ ~-3.1 ~ {Invisible:1b,NoBasePlate:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:"bread",Count:1b}],HandItems:[{},{}]}
summon armor_stand ~ ~-3.7 ~ {Invisible:1b,NoBasePlate:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:"melon_slice",Count:1b}],HandItems:[{},{}]}
summon armor_stand ~ ~-4.1 ~ {Invisible:1b,NoBasePlate:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:"apple",Count:1b}],HandItems:[{},{}]}
@NeraSnow
NeraSnow / mma12_0_keygen.cpp
Created May 3, 2021 17:29
mma12_0_keygen.cpp
#include <iostream>
#include <string>
using namespace std;
//number for 11.2
//int magicNumbers[] = {10690, 10744, 12251, 17649, 27280, 42041, 42635, 53798, 56180, 58535, 61041};
//number for 12.0
int magicNumbers[] = {10690, 12251, 17649, 24816, 33360, 35944, 36412, 42041, 42635, 44011, 53799, 56181, 58536, 59222, 61041};
@NeraSnow
NeraSnow / MapleTeXOutputColoring.sh
Last active March 12, 2022 23:44
Maple TeX Output Customize
sed -i '/\\begin{dmath}/s/$/ \\color{blue}/' q1.tex
@NeraSnow
NeraSnow / 九八新闻台_fetchRSS.py
Created August 20, 2022 01:08
Podcast Fetching Scripts
import feedparser
import urllib
import requests
import sys
import os
import re
import subprocess
ParentPath = '/u/USER_ID/public_html/Podcast/九八新闻台/'
RSSFeed = 'https://feeds.soundcloud.com/users/soundcloud:users:496937352/sounds.rss'