Skip to content

Instantly share code, notes, and snippets.

View Snegovikufa's full-sized avatar
📍
Push the red button

Rustam Safin Snegovikufa

📍
Push the red button
View GitHub Profile
@Snegovikufa
Snegovikufa / stopwatch.snippet
Created February 7, 2014 10:37
Surround with stopwatch Resharper template
Stopwatch $stopwatch$ = new Stopwatch();
stopwatch.Start();
$SELECTION$
$stopwatch$.Stop();
Console.WriteLine("EXEC TIME {0}", $stopwatch$.ElapsedMilliseconds);
$END$
@Snegovikufa
Snegovikufa / Earthsong.xml
Created February 22, 2014 02:23
"Earthsong" code style for Qt creator
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="Eartsong">
<style name="Text" foreground="#ebd1b7" background="#36312c"/>
<style name="Link" foreground="#66d9ef"/>
<style name="Selection" foreground="#e6e5e2" background="#161A1F"/>
<style name="LineNumber" foreground="#a0a19c" background="#272822"/>
<style name="SearchResult" foreground="#ffffff" background="#2572b8"/>
<style name="SearchScope" foreground="#000000" background="#e2efff"/>
<style name="Parentheses" foreground="#ff0000" background="#515d6a"/>
<style name="CurrentLine" background="#3e3d32"/>
@Snegovikufa
Snegovikufa / wpf_dpi.cs
Created February 25, 2014 02:32
How to get dpi settings in WPF
var dpiXProperty = typeof(SystemParameters).GetProperty("DpiX", BindingFlags.NonPublic | BindingFlags.Static);
var dpiYProperty = typeof(SystemParameters).GetProperty("Dpi", BindingFlags.NonPublic | BindingFlags.Static);
var dpiX = (int)dpiXProperty.GetValue(null, null);
var dpiY = (int)dpiYProperty.GetValue(null, null);
public static void RegisterBundles(BundleCollection bundles)
{
bundles.IgnoreList.Clear();
AddDefaultIgnorePatterns(bundles.IgnoreList);
}
public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
{
if (ignoreList == null)
{
@Snegovikufa
Snegovikufa / App.xaml.cs
Last active August 29, 2015 14:04
Set application-wide own culture
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Markup;
namespace WpfApplication1
{
/*
@Snegovikufa
Snegovikufa / test_queue.py
Created February 16, 2015 04:11
Shows how to run many Python threads and wait them to complete. It's very good for I/O operations, not for CPU high load operations!
# -*- coding: utf-8 -*-
__author__ = 'Rustam Safin'
import threading
from Queue import Queue
import time
import random
import logging
@Snegovikufa
Snegovikufa / leaks.py
Created February 17, 2015 03:51
Identify memory leaks in python
from pympler import refbrowser
ib = refbrowser.InteractiveBrowser(root)
ib.main()
@Snegovikufa
Snegovikufa / multi.py
Last active August 29, 2015 14:15
Parallel processing of dictionary
from multiprocessing import Pool, cpu_count
import time
import random
import logging
from pprint import pprint
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
@Snegovikufa
Snegovikufa / run
Last active August 29, 2015 14:15
How to set Omnibus Gitlab sidekiq workers. Edit file /opt/gitlab/sv/sidekiq/run
#!/bin/sh
cd /var/opt/gitlab/gitlab-rails/working
exec 2>&1
exec chpst -e /opt/gitlab/etc/gitlab-rails/env -P \
-U git -u git \
/opt/gitlab/embedded/bin/bundle exec sidekiq \
# ADD THE LINE BELOW AND SET NUMBER OF WORKERS
@Snegovikufa
Snegovikufa / appcast.xml
Last active August 29, 2015 14:20
Appcast template
<?xml version="1.0" encoding="utf-8"?>
<item>
<title>New version 2.13.2 available!</title>
<version>2.13.2</version>
<url>https://github-windows.s3.amazonaws.com/GitHubSetup.exe</url>
<changelog>https://windows.github.com/release-notes.html</changelog>
</item>