Skip to content

Instantly share code, notes, and snippets.

View beginor's full-sized avatar
💭
Coding for code!

beginor beginor

💭
Coding for code!
View GitHub Profile
@beginor
beginor / mac_ram_disk.sh
Created June 15, 2014 10:21
script create ramdisk on mac os x
if ! test -e /Volumes/\"Ramdisk\" ; then
diskutil erasevolume HFS+ \"RamDisk\" `hdiutil attach -nomount ram://$((2*1024*512))`
mkdir -p /Volumes/RamDisk/Caches
mkdir -p /Volumes/RamDisk/Logs
fi
@beginor
beginor / sql-cursor-sample.sql
Last active August 29, 2015 14:02
Sql Server Cursor Sample
Use Northwind
Go
Declare @CatId Int, @CatName NvarChar(50)
Declare catCur Cursor For
Select c.CategoryId, c.CategoryName From Categories c
Open catCur
Fetch Next From catCur InTo @CatId, @CatName
@beginor
beginor / mysql-cursor-demo.sql
Created June 24, 2014 08:10
MySql Cursor Demo
DELIMITER $$
CREATE DEFINER=`udev`@`%` PROCEDURE `build_email_list`(INOUT email_list varchar(4000))
BEGIN
DECLARE v_finished INTEGER DEFAULT 0;
DECLARE v_email varchar(100) DEFAULT "";
-- declare cursor for employee email
DEClARE email_cursor CURSOR FOR
// This sample will guide you through elements of the F# language.
//
// *******************************************************************************************************
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter or right-click
// and select "Execute in Interactive". You can open the F# Interactive Window from the "View" menu.
// *******************************************************************************************************
//
// For more about F#, see:
// http://fsharp.net
//
/****************************************************************************
* Author: Alberto Gutiérrez Jácome <[email protected]>
* Date: 16/09/2012
*
* Compilation: javac KdTree.java
* Execution: not applicable
* Dependencies: Point2D.java RectHV.java StdDraw.java Queue.java
*
* Description: A mutable data type that uses a 2d-tree to represent a set of
* points in the unit square. A 2d-tree is a generalization of a BST to
@beginor
beginor / main.c
Last active July 6, 2024 17:08
Windows Service with c
#include <windows.h>
#include <stdio.h>
#define SLEEP_TIME 5000
#define LOGFILE "C:\\memstatus.txt"
int WriteToLog(char* str) {
FILE* log;
log = fopen(LOGFILE, "a+");
if (log == NULL)
#!/bin/bash
#
#Usage:
#1.) Install cygwin and make sure you select the following packages:
#- gcc-mingw
#- pkg-config
#- mingw-zlib1
#- mingw-zlib-devel
#
#2.) Install the following Mono release package: "Mono for Windows, Gtk#, and XSP"
@beginor
beginor / uninstall-all-gems-osx.sh
Created October 16, 2014 06:27
uninstall all gems osx
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
require.config({
paths: {
/* other paths are omitted */
'bootstrap': '../libs/bootstrap'
},
shim: {
'bootstrap/affix': { deps: ['jquery'], exports: '$.fn.affix' },
'bootstrap/alert': { deps: ['jquery'], exports: '$.fn.alert' },
'bootstrap/button': { deps: ['jquery'], exports: '$.fn.button' },
'bootstrap/carousel': { deps: ['jquery'], exports: '$.fn.carousel' },
@beginor
beginor / share-read.cs
Created November 7, 2014 02:25
Open a file used by another process.
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var sr = new StreamReader(fs, Encoding.Default)) {
// read the stream
//...
}