Skip to content

Instantly share code, notes, and snippets.

public static string GenerateSaltedSHA1(string plainTextString)
{
HashAlgorithm algorithm = new SHA1Managed();
var saltBytes = GenerateSalt(4);
var plainTextBytes = Encoding.ASCII.GetBytes(plainTextString);
var plainTextWithSaltBytes = AppendByteArray(plainTextBytes, saltBytes);
var saltedSHA1Bytes = algorithm.ComputeHash(plainTextWithSaltBytes);
var saltedSHA1WithAppendedSaltBytes = AppendByteArray(saltedSHA1Bytes, saltBytes);
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
public static class CodeTimer
{
public static void Initialize()
{
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
@junxy
junxy / mono.rb
Last active January 4, 2016 09:09 — forked from pallih/mono.rb
brew install mono 3.2.6
# http://www.mono-project.com/Compiling_Mono_on_OSX
# Version 3.2.6
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.2.6.tar.bz2'
sha1 '27a08194f21ab853c669f42a1435e3a6fc326b8b'
#url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
#sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'
@junxy
junxy / HtmlHelpers.cs
Last active August 29, 2015 13:56 — forked from ChrisWay/HtmlHelpers.cs
bootstrap nav active link setting asp.net mvc htmlhelper ref: http://chrisondotnet.com/2012/08/setting-active-link-twitter-bootstrap-navbar-aspnet-mvc/
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Linq;
namespace Web.Extensions
{
public static class HtmlHelpers
{
public static MvcHtmlString MenuLink(this HtmlHelper htmlHelper, string linkText, string actionName,
string controllerName, bool onlyMatchCt = false, string[] relatedCts = null)
class TestIntellijIdea < Cask
version '13.1.3'
sha256 'ae5239e0a5670dec88c39a5157103084d0ddd2c0b8d732d6af07764f0b98b624'
url 'http://dev-download.oceanwing.com/ideaIU-13.1.3.dmg'
homepage 'https://www.jetbrains.com/idea/index.html'
link 'IntelliJ IDEA 13.app'
caveats do
<<-EOS.undent
@junxy
junxy / GIF-Screencast-OSX.md
Last active August 29, 2015 14:05 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@junxy
junxy / conf.ifconfig
Created August 22, 2014 09:27
自带的配置有问题,会卡在一个地方,并且有个 Python 在后台运行最终导致内存爆满。(支持 IP v6) ref https://github.com/DmitriyLyalyuev/DotFiles/blob/master/.grc/conf.ifconfig
# number
regexp=\d+(\.\d+)?
colours=white
=======
# ip
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=magenta
=======
# hwaddr
regexp=(\d|[A-Fa-f])+(\:(\d|[A-Fa-f])+)+
@junxy
junxy / ad_hosts
Last active August 29, 2015 14:16
手机app ad列表,来源:http://www.soomal.com/doc/10100004235.htm
127.0.0.1 analytics.admob.com
127.0.0.1 api.admob.com
127.0.0.1 e.admob.com
127.0.0.1 c.admob.com
127.0.0.1 media.admob.com
127.0.0.1 mm.admob.com
127.0.0.1 mmv.admob.com
127.0.0.1 p.admob.com
127.0.0.1 r.admob.com
127.0.0.1 config.adsage.cn
@junxy
junxy / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@junxy
junxy / javascript_resources.md
Last active August 29, 2015 14:19 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage