Skip to content

Instantly share code, notes, and snippets.

View DuckOfDoom's full-sized avatar

Vladimir Yanovsky DuckOfDoom

View GitHub Profile
@DuckOfDoom
DuckOfDoom / linecounter.rb
Last active August 29, 2015 14:15
Line counter
dirs = Dir.glob('**/Assets/Scripts') + Dir.glob('**/Assets/Tests')
files = []
dirs.each do |d|
files.concat(Dir.glob( File.join(d, '**', '*.cs')))
end
filesCount = files.length
linesCount = 0
@DuckOfDoom
DuckOfDoom / TypeMembersLayout
Last active August 29, 2015 14:18
Type Members Layout
<?xml version="1.0" encoding="utf-8" ?>
<!--
I. Overall
I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used
I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries
I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared
I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property
@DuckOfDoom
DuckOfDoom / grepout
Last active December 2, 2016 16:16
Checking out git branches with grep
#!/usr/bin/env ruby
command = 'git branch -a'
unless ARGV[0].nil?
command += ' | grep ' + ARGV[0]
end
lines = IO.popen(command).readlines
if lines.count == 0
@DuckOfDoom
DuckOfDoom / .gitconfig
Last active February 25, 2016 20:38
Git Config
[core]
autocrlf = false
preloadindex = true
fscache = true
editor = vim
ignorecase = false
[alias]
bclean = "!f() { git remote prune origin && git branch --merged develop | grep -v -e "develop" -e "master" | xargs -r git branch -d;}; f"
adc = !git lg -5 && git add -A :/ && git status && git commit
lcm = log -1 --pretty=%B
require 'json'
if ARGV.size < 1
puts "Enter file name"
exit
end
json = JSON.parse File.open(ARGV[0], 'r').read
beautiful = JSON.pretty_generate json
File.open(ARGV[0], 'w').write(beautiful)
@DuckOfDoom
DuckOfDoom / FaceOnCamera.cs
Last active January 25, 2016 12:58
Unity3d FaceOnCamera
using System;
using UnityEngine;
/// <summary>
/// Поворачивает объект Z-осью на камеру. Также можно указать, какая ось объекта будет смотреть вверх.
/// </summary>
public class FaceOnCamera : MonoBehaviour
{
[SerializeField] private bool _faceOnEditorCamera;
[SerializeField] private Axis _axisUp = Axis.Y;
@DuckOfDoom
DuckOfDoom / paredit.txt
Created February 25, 2016 20:36
Vim paredit help
*paredit.txt* Paredit Last Change: 29 Dec 2013
Paredit Mode for Vim *paredit* *slimv-paredit*
Version 0.9.12
The paredit.vim plugin performs structured editing of s-expressions used in
the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv
but it is also distributed separately as a standalone plugin.
|paredit-mode| Paredit mode
@DuckOfDoom
DuckOfDoom / gist:88c4627273da2182fe84841c9bdca125
Created October 7, 2016 10:38
Delete git tag from origin.
git tag -d 12345
git push origin :refs/tags/12345
@DuckOfDoom
DuckOfDoom / Main.hs
Last active November 7, 2016 15:56
Html parsing
{-# OPTIONS_GHC -Wall #-}
{-# TemplateHaskell #-}
module Main where
import Control.Lens (makeLenses, (.~), (^.))
import Data.List.Split (chunksOf)
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as LBS (writeFile, toStrict)
@DuckOfDoom
DuckOfDoom / apkinstaller.py
Last active February 23, 2024 14:29
Python apk/obb installer. Chooses the most recent apk/obb by modification date, installs .apk and pushes obb to special folder
#!python
import os
import subprocess
package = "COM.YOUR.PACKAGE"
os.chdir(os.environ["HOME"] + "/Downloads")
def isApk(f):