Skip to content

Instantly share code, notes, and snippets.

View holyketzer's full-sized avatar

Alex Emelyanov holyketzer

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
namespace Microsoft.SystemCenter.Visualization.Component.Extensions.Library.Controls.Web.Components
{
public class MathUtills
{
curl_setopt($ch, CURLOPT_URL, $captcha[0]); // Pass URL as parameter.
// тут не знаю как правильно заполнить и всё ли нужно
curl_setopt($ch, CURLOPT_USERAGENT, $agents);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE);
// вот это я так понял обязательно, результат + в двоичном виде
@holyketzer
holyketzer / ClassHealthStatisticsDataType.mpx
Last active December 22, 2015 00:29
IDataObject client implementation
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<SchemaTypes>
<SchemaType ID="VIAcode.AwsExtension.Schema.ClassHealthStatisticsDataType" Accessibility="Public">
<xs:complexType name="ClassHealthStatistics" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sc="http://schemas.microsoft.com/SystemCenter/Common/TypeExtensions>">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="ClassName" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xs:element name="HealthState" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xs:element name="EntitiesCount" type="xsd:integer" minOccurs="1" maxOccurs="1" />
<xs:element name="Color" type="xs:anyType" sc:type="xsd://Microsoft.SystemCenter.Visualization.Library!Microsoft.SystemCenter.Visualization.ChartDataTypes/HexColor" minOccurs="1" maxOccurs="1" />
@holyketzer
holyketzer / Gemfile
Created September 18, 2013 10:11
Has secure password
# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
@holyketzer
holyketzer / DataQuerySample.cs
Last active December 24, 2015 01:49
SCOM DataQuerySample.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Net;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
let main () =
let gr () = Scanf.scanf " %d" (fun i -> i) in
let n = gr () in
let m = gr () in
let d = gr () in
Printf.printf "%d %d %d" n m d
;;
let _= main();;
@holyketzer
holyketzer / Behaviour.mpx
Created October 2, 2013 11:33
Implementation of SCOM behavior that add menu items (tasks) under "gear box"
<ComponentBehavior ID="Microsoft.SystemCenter.Visualization.Component.Library.ObjectHealthWidgetShowHideMonitorsBehavior"
BehaviorTypeId="Microsoft.SystemCenter.Visualization.Component.Library.ShowHideMonitorsBehaviours"
ComponentTypeId="Here is your target component (can be visual or not)"
Accessibility="Internal">
<Bindings>
</Bindings>
</ComponentBehavior>
</ComponentBehaviors>
<BehaviorTypes>
def res(n)
if n==1
1
elsif n==2
2
else
res(n-1)+res(n-2)
end
end
@holyketzer
holyketzer / power.sh
Created October 11, 2013 07:21
/etc/acpi/power.sh and /etc/rc.local For good laptop powersaving. I reccommend it!
#!/bin/sh
if on_ac_power; then
echo "Power mode"
echo 0 > /proc/sys/vm/laptop_mode
echo 10 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
@holyketzer
holyketzer / sequences.sql
Last active December 30, 2015 15:09
PostgreSQL tricks
/* Get all sequences names */
/* select pg_get_serial_sequence('table', 'key'); */
select pg_get_serial_sequence('specializations', 'id');
/* Change sequence last value */
/* SELECT setval('sequence name', (SELECT MAX(key) FROM table)+1); */
SELECT setval('public.specializations_id_seq', (SELECT MAX(id) FROM specializations)+1);