Skip to content

Instantly share code, notes, and snippets.

Avatar

James Swineson Jamesits

View GitHub Profile
View fixwmi.bat
@echo on
cd /d c:\temp
if not exist %windir%\system32\wbem goto TryInstall
cd /d %windir%\system32\wbem
net stop winmgmt
winmgmt /kill
if exist Rep_bak rd Rep_bak /s /q
rename Repository Rep_bak
for %%i in (*.dll) do RegSvr32 -s %%i
for %%i in (*.exe) do call :FixSrv %%i
@Jamesits
Jamesits / NPS-Config-Sync.ps1
Created Dec 21, 2019
Sync 2 Network Policy Servers' configuration
View NPS-Config-Sync.ps1
###Network Policy Server Synchronization Script
#This script copies the configuration from the NPS Master Server and imports it on the secondary server.
#The Account that this script runs under must have Local Administrator rights to the NPS Master.
#This was designed to be run as a scheduled task on the NPS Secondary Servers on an hourly,daily, or as-needed basis.
# Modified from https://deployhappiness.com/two-network-policy-server-tricks-subnets-and-syncing/
###Variables
#NPSMaster - Your Primary Network Policy Server you want to copy the config from.
$NPSMaster = "adds0.corp.contoso.com"
$NPSSecondary = "adds1.corp.contoso.com"
View douban-celebrity-photos-crawler.py
#!/usr/bin/env python3
import logging
import typing
import os
import shutil
import time
import requests
from bs4 import BeautifulSoup
# logging
@Jamesits
Jamesits / opensuse_gnome_themes.sh
Created Oct 28, 2018
OpenSUSE basic customization
View opensuse_gnome_themes.sh
sudo zypper addrepo https://download.opensuse.org/repositories/home:lbssousa:numix/openSUSE_Leap_15.0/home:lbssousa:numix.repo
sudo zypper in autoconf automake sassc pkg-config gtk3-devel gnome-themes-standard gtk2-engine-murrine numix-icon-theme
git clone https://github.com/andreisergiu98/arc-flatabulous-theme --depth 1 && cd arc-flatabulous-theme
./autogen.sh --prefix=/usr
sudo make install
@Jamesits
Jamesits / cloudflare_update_ddns.sh
Created Sep 4, 2018
Update dynamic DNS entry on CloudFlare
View cloudflare_update_ddns.sh
#!/bin/bash
set -eu
# account config
AUTH_EMAIL="your-email@domain.tld"
AUTH_KEY="xxxxxxxxxxxxxxxxxxxxxxxxx"
ZONE_IDENTIFIER="yyyyyyyyyyyyyyyyyyyyyyyyyy"
RECORD_IDENTIFIER="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# record config
@Jamesits
Jamesits / nds.log
Last active May 1, 2018
DSLinux boot dmesg - iQue DS lite, M3 Lite Professional MicroSD expension card https://youtu.be/3_eYCO_clR0
View nds.log
Linux version 2.6.14-hsc0ds (stsp@len) (gcc version 4.0.4) #5 Mon Feb 27 17:02:50 CET 2012
CPU: ARM946E [41009460] revision 0 (ARMvundefined/unknown)
Machine: Nintendo DS
Memory management: Non-Paged(unused/noMMU)
Ignoring unrecognised tag 0x00000000
On node 0 totalpages: 9216
DMA zone: 9216 pages, LIFO batch:3
Normal zone: 0 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
CPU0: D VIVT write-back cache
@Jamesits
Jamesits / high-frequency-square-wave-generator-esp8266.ino
Last active Aug 4, 2020
High-accuracy square wave generator (up to 250KHz) based on ESP8266, with runtime adjustable frequency, PWM width and offset.
View high-frequency-square-wave-generator-esp8266.ino
// High-accuracy square wave generator
// based on ESP8266
// with runtime adjustable frequency, PWM width and offset
// Output wave at pin 5 (configurable from 0 to 15, but not 16)
// by James Swineson <github@public.swineson.me>, 2017-10
// https://gist.github.com/Jamesits/92394675c0fe786467b26f90e95d3904
// See https://blog.swineson.me/implementation-of-6mbps-high-speed-io-on-esp8266-arduino-ide/
// for more information (article in Chinese)
// Arduino UNO version: https://gist.github.com/Jamesits/8d164818946a65d0cafcd6203e3e5049
@Jamesits
Jamesits / preload.cpp
Created Sep 8, 2017 — forked from m13253/preload.cpp
Preload files into memory cache, for example IME database, in case you have a slow HDD.
View preload.cpp
#include <windows.h>
#include <string>
using namespace std::string_literals;
constexpr size_t buffer_size = 64*1024;
static char buffer[buffer_size];
static DWORD PrintString(HANDLE h_stdout, std::wstring const& string) {
DWORD count;
@Jamesits
Jamesits / docker_cleanup.sh
Created Aug 23, 2017
Docker cleanup unused things
View docker_cleanup.sh
#!/usr/bin/env bash
# USE WITH CAUTION
# remove all exited containers
docker rm $(docker ps -a -f status=exited -f status=created -q)
# remove dangling volumes
docker volume rm $(docker volume ls -f dangling=true -q)
View ubuntu_enable_bbr.sh
#!/bin/bash
set -eu
SYSCTL_FILE=/etc/sysctl.d/90-tcp-bbr.conf
# check root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
You can’t perform that action at this time.