Skip to content

Instantly share code, notes, and snippets.

Andrew Savinykh AndrewSav

  • New Zealand
Block or report user

Report or block AndrewSav

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View telnet-client.txt
#alpine
apk -U add busybox-extras
#windows
pkgmgr /iu:"TelnetClient"
#ubuntu
apt update
apt install telnet -y
View ReadWriteLock.ps1
function WaitAnyMutexes($mutexes, $name, $timeout) {
try {
$result = [Threading.WaitHandle]::WaitAny($mutexes,$timeout)
if ($result -ne [Threading.WaitHandle]::WaitTimeout) {
return @{clean=$true; mutex=$mutexes[$result]; index=$result};
} else {
return $null
}
} catch [System.Threading.AbandonedMutexException]{
return @{clean=$false; mutex=$_.Exception.Mutex; index=$_.Exception.MutexIndex}
View GetSteamGuardCode.cs
string GetSteamGuardCode(string base64SharedSecret)
{
long time = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + 10;
byte[] timeHash = BitConverter.GetBytes(time/30).Reverse().ToArray();
HMACSHA1 hmac = new HMACSHA1(Convert.FromBase64String(base64SharedSecret));
hmac.Initialize();
byte[] hash = hmac.ComputeHash(timeHash);
int b = hash[19] & 0xF;
int codePoint = (hash[b] & 0x7F) << 24 | (hash[b + 1] & 0xFF) << 16 | (hash[b + 2] & 0xFF) << 8 | (hash[b + 3] & 0xFF);
string steamChars = "23456789BCDFGHJKMNPQRTVWXY";
@AndrewSav
AndrewSav / Install_7zip_on_Linux.md
Last active Jun 30, 2017 — forked from P7h/Install_7zip_on_Linux.md
7zip install on Linux -- Ubuntu and Fedora or CentOS / RHEL
View Install_7zip_on_Linux.md

Steps to install 7zip on Linux » Ubuntu and Fedora or CentOS / RHEL

Ubuntu

cat /etc/*release
sudo apt-get update -yqq
sudo apt-get install -yqq p7zip-full
View keybase.md

Keybase proof

I hereby claim:

  • I am andrewsav on github.
  • I am andrewsav (https://keybase.io/andrewsav) on keybase.
  • I have a public key ASDGwsBD4XevNgeWO_vRgxPGBjCe90gWabx8hYpMXsXksgo

To claim this, I am signing this object:

View Program.cs
using System;
using Microsoft.Extensions.CommandLineUtils;
namespace hwapp
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine(GetValue());
@AndrewSav
AndrewSav / clone-all-twitter-github-repos.ps1
Last active Feb 10, 2017
Clone all github repos in an organisation
View clone-all-twitter-github-repos.ps1
(Invoke-WebRequest "https://api.github.com/orgs/twitter/repos?per_page=200").Content | ConvertFrom-Json | %{ $_.clone_url } | %{ git clone $_}
View EnPlusOne.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
namespace EnPlusOne
{
public interface IMyDbContext : IDisposable
@AndrewSav
AndrewSav / pln.cs
Last active Apr 18, 2016
TCP Port Listener
View pln.cs
// This is a very basic TCP port listener that allows you to listen on a port range
// If you run this program outside of firewall and run a port scanner inside a firewall
// pointing to the ip address where this program runs, the port scanner will be able you
// to tell which exactly ports are open on the firewall
// This code will run on Windows, but most importantly also on linux.
// DigitalOcean.com has all ports for their VMs open by default. So spin a new VM,
// copy pln.cs in your (root) home folder and then run:
// sudo apt-get update
// sudo apt-get install mono-complete -y
// mcs pln.cs
@AndrewSav
AndrewSav / UwpEventSource.cs
Created Apr 17, 2016
Event Provider sample for Windows IoT
View UwpEventSource.cs
using System.Diagnostics.Tracing;
namespace MyNamespace
{
[EventSource(Name = "MyEwtProvider")]
sealed class UwpEventSource : EventSource
{
public static UwpEventSource Log = new UwpEventSource();
[Event(1, Level = EventLevel.Verbose, Channel = EventChannel.Debug)]
You can’t perform that action at this time.