Skip to content

Instantly share code, notes, and snippets.

View sergebat's full-sized avatar

Sergey Batishchev sergebat

  • Vancouver, BC, Canada
View GitHub Profile
@sergebat
sergebat / choco-install-all.cmd
Created June 2, 2021 11:29
Install all my Windows software with https://chocolatey.org/ package manager
rem Check admin permissions
echo off
net session >nul 2>&1
if %errorLevel% == 0 (
echo Elevated command prompt confirmed
) else (
echo This script can only run from the ELEVATED command prompt.
echo Press Windows-X and launch (Command Line - Administrator)
exit 1
)
@sergebat
sergebat / extractbody.sh
Created October 9, 2020 15:03
Shell script to extract body tag from index.html
#!/bin/sh
sed -n '/<body>/,/<\/body>/{//!p}' dist/index.html > dist/body.txt
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR
SUMMARY:Event summary
DTSTART;VALUE=DATE:20180430
SEQUENCE:0
DESCRIPTION:Event description
END:VEVENT
END:VCALENDAR
Shader "Custom/ACNH_SewingCloth"
{
Properties
{
[NoScaleOffset] _MainTex ("Albedo (RGB)", 2D) = "white" {}
[NoScaleOffset] _BumpMap ("Normal Map", 2D) = "bump" {}
[NoScaleOffset] _EdgeAlpha ("Alpha", 2D) = "white" {}
_Cutoff ("Alpha Test Cutoff", Range(0,1)) = 0.5
_Offset ("Offset (XY)", Vector) = (0,0,0,0)
@sergebat
sergebat / index.html
Last active November 25, 2021 14:23
mraid example
<script src="mraid.js"></script>
<script type="text/javascript">
// Initialize mraid
function initMraid() {
if (!isMraidAvailable()) {
showAd();
return;
}
if (mraid.getState() === "loading") {
echo off
rem *** Configuration ***
set PUTTY_SESSION="mbp.local"
set ALTOOL_USER_NAME=your.appstore.account@example.com
set ALTOOL_USER_PASSWORD=aaaa-bbbb-cccc-dddd
set ALTOOL_PATH_OSX='/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool'
IF "%~1"=="" goto noparams
where pscp > nul
@sergebat
sergebat / build-all.ps1
Created November 17, 2018 12:37
Powershell #oneliner - build all projects in subdirectories
ls -dir | %{pushd $_; npm run make; popd}
@sergebat
sergebat / SingletonScriptable.cs
Created October 18, 2018 18:39 — forked from nagedev/SingletonScriptable.cs
SingletonScriptable
using System.Linq;
using UnityEditor;
using UnityEngine;
public abstract class SingletonScriptable<T> : ScriptableObject where T : ScriptableObject
{
static T _instance = null;
public static T instance
{
get
@sergebat
sergebat / typescript.json
Last active October 8, 2018 18:13
VSCode snippet: TypeScript class default export from module (class name === file name)
{
"PublicClass": {
"prefix": "clazz",
"body": [
"export default class $TM_FILENAME_BASE {",
"\tconstructor() {",
"\t}",
"}",
""
],
@sergebat
sergebat / index.ts
Last active September 5, 2018 09:47
Method call log with experimental Typescript decorators
const DEBUG = false;
const logDebug = function(_target: any, key: string, descriptor: PropertyDescriptor): any {
const originalMethod = descriptor.value;
descriptor.value = function(...args: any[]) {
const functionName = key;
console.log(functionName + "(" + args.join(", ") + ")");
const result = originalMethod.apply(this, args);
console.log("=> " + result);
return result;