Skip to content

Instantly share code, notes, and snippets.

View kad1r's full-sized avatar

Kadir Avcı kad1r

View GitHub Profile
@leekelleher
leekelleher / backup-dev.bat
Created April 13, 2012 17:33
Personal batch script to quickly back-up my MSSQL database and wwwroot files, (typically for use with Umbraco).
:: ###### BACK-UP JOB ######
@ECHO OFF
:: Set the constants
SET BACKUP_DIR=C:\path\to\_backup
SET TEMP_DIR=%BACKUP_DIR%\TEMP
SET TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
SET ARCHIVE_DIR=%BACKUP_DIR%\%TODAY%
SET WWWROOT_NAME="ProjectName"
SET WWWROOT_SOURCE=C:\path\to\wwwroot
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@antdimot
antdimot / Repository.cs
Last active July 7, 2022 23:59
Example of mongodb repository in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
@kad1r
kad1r / License.cs
Last active December 16, 2015 02:19
License for cpu Id, hdd Id, bios Id
//CPU ID
string sQuery = "SELECT ProcessorId FROM Win32_Processor";
ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);
ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)
{
sProcessorID = (string)oManagementObject["ProcessorId"];
}
//HDD ID
ManagementObjectSearcher searcher = new
@leegould
leegould / jquery.newguid.js
Last active July 15, 2018 06:46
Jquery plugin for creating a new guid.
/* Jquery function to create guids.
* Guid code from
* http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
*/
(function ( $ ) {
$.fn.newguid = function () {
this.val('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : r & 0x3 | 0x8; return v.toString(16); }));
return this;
};
@oazabir
oazabir / gist:8e3187b5756b25b52393
Created September 29, 2014 12:11
Build, deploy, anonymize config, zip package, git commit, push from a single command
# Build, anonymize config, deploy, zip, commit, push in one shot
param (
[string]$solution = "OracleDashboard.sln",
[string]$zipname = "OracleDashboard.zip",
[string]$compressor = "c:\Program Files\7-Zip\7z.exe",
[string]$folder = "OracleDashboard",
[string]$deployPath = "..\Binary",
[string]$commitFrom = "..",
[Parameter(Mandatory=$true)][string]$comment
)
@aladagemre
aladagemre / sehirler.html
Created November 10, 2014 17:50
Türkiye Şehir Listesi HTML Select Option
<select name="Sehir">
<option value="0">------</option>
<option value="1">Adana</option>
<option value="2">Adıyaman</option>
<option value="3">Afyonkarahisar</option>
<option value="4">Ağrı</option>
<option value="5">Amasya</option>
<option value="6">Ankara</option>
<option value="7">Antalya</option>
<option value="8">Artvin</option>
@ademilter
ademilter / Proje Klasör Düzeni
Last active February 19, 2024 11:23
Proje klasör düzeni
root/
|-- scss/ # https://gist.github.com/ademilter/746cb307f14bd4e32de1#file-scss
|
|-- js/ # Script klasörü
| |-- plugin/ - Eklentilere ait scriptler
| |-- pages/ - Sayfalara özel scriptler
| |-- plugin.js - Plugin klasöründeki dosyaları bu dosya içinde birleştiriyoruz
| |-- main.js - Global olan bütün scriptleri buraya yazıyoruz
|
|-- img/ # Ham tasarım ve sprite gibi dosyalar (psd, sketch, ai, vs...)

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@anova
anova / Twitter_WebRequest_Json.cs
Created October 27, 2015 17:56
Twitter WebRequest example
//https://dev.twitter.com/oauth/application-only
//Step 1
string strBearerRequest = HttpUtility.UrlEncode(this.ConsumerKey) + ":" + HttpUtility.UrlEncode(this.ConsumerSecret);
//http://stackoverflow.com/a/11743162
strBearerRequest = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(strBearerRequest));
//Step 2
WebRequest request = WebRequest.Create("https://api.twitter.com/oauth2/token");
request.Headers.Add("Authorization", "Basic " + strBearerRequest);
request.Method = "POST";