Skip to content

Instantly share code, notes, and snippets.

View mopsicus's full-sized avatar
🎯
Focusing

Igor mopsicus

🎯
Focusing
View GitHub Profile
@mopsicus
mopsicus / turbo_aegea.php
Last active July 7, 2021 23:30
Generate RSS channel file Yandex turbo for Aegea blogengine
<?
$db_user = ''; // db user name
$db_password = ''; // db pass
$db_database = ''; // db name
$db_host = 'localhost'; // db url
$db = new mysqli($db_host, $db_user, $db_password, $db_database);
$result = $db->query("SELECT * FROM `notes` WHERE IsPublished = 1 AND isvisible = 1 ORDER BY `Stamp` DESC LIMIT 1");
@mopsicus
mopsicus / SnapPosition.cs
Created January 16, 2020 09:21
Snap position for screen edges with offset
using UnityEngine;
/// <summary>
/// Fix position for objects in non canvas
/// </summary>
[ExecuteInEditMode]
public class SnapPosition : MonoBehaviour {
/// <summary>
/// Anchor settings
@mopsicus
mopsicus / DefaultStencil.shader
Last active January 28, 2020 07:03
DefaultStencil.shader (old shader for old Unity version)
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Sprites/DefaultStencil"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
@mopsicus
mopsicus / installtools.sh
Created February 26, 2020 09:07
Bash script for uninstalling and installing apk on multiple connected devices at once
#!/bin/bash
clear
START=$(date +"%s")
function ShowElapsedTime {
echo ''
end=$(date +"%s")
elapsed=$(($end-$START))
@mopsicus
mopsicus / TextGradient.cs
Last active July 17, 2024 08:50
Apply gradient to whole TMP text, but no for each character
// ----------------------------------------------------------------------------
// The MIT License
// TextGradient https://gist.github.com/mopsicus/9d344451ca614d7e9937bc0c6da2b21d
// Copyright (c) 2020 Mopsicus <mail@mopsicus.ru>
// ----------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
@mopsicus
mopsicus / PreBuildManifestUpdate.cs
Created September 27, 2021 07:11
Update AndroidManifest.xml before build to set hardwareAccelerated to true
using System.IO;
using System.Text;
using System.Xml;
using UnityEditor.Android;
public class PreBuildManifestUpdate : IPostGenerateGradleAndroidProject {
/// <summary>
/// Method runs after gradle generated, before build
/// </summary>
@mopsicus
mopsicus / EmojiHelper.cs
Last active August 2, 2024 20:53
Helper for TextMeshPro to find and parse emoji
// ----------------------------------------------------------------------------
// The MIT License
// EmojiHelper https://gist.github.com/mopsicus/3903a1f111a738375a363b9e3f058385
// Copyright (c) 2022 Mopsicus <mail@mopsicus.ru>
// ----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@mopsicus
mopsicus / loto_cards_generator.html
Created December 2, 2024 14:14
Russian Lotto card generator. Generate any number of pages with 4 cards to play.
<!-- This code generated via ChatGPT by Mopsicus -->
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Генератор карточек для Русского Лото</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.17.1/pdf-lib.min.js"></script>
<style>
body {