Skip to content

Instantly share code, notes, and snippets.

View ardeshir's full-sized avatar
🎯
Focusing

sepahsalar ardeshir

🎯
Focusing
View GitHub Profile
@ardeshir
ardeshir / Sia
Created November 5, 2013 20:26
Sia Runtime Lexer for LLVM
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
//===----------------------------------------------------------------------===//
// Lexer
//===----------------------------------------------------------------------===//
/*
@ardeshir
ardeshir / ADfill.sql
Created January 12, 2014 20:03
Active Directory Fill into SQL Server
USE [Adatadb]
GO
/****** Object: StoredProcedure [dbo].[CORE_AD_FILL] ******/
SET ANSI_NULLS ON
GO
@ardeshir
ardeshir / shell.c
Last active January 3, 2016 07:28
Simple Shell
#include "apue.h"
#include <sys/wait.h>
static void sig_int(int); /* our signal-catching function */
int main(void) {
char buf[MAXLINE]; /* from apue.h */
pid_t pid;
int status;
@ardeshir
ardeshir / main.js
Last active January 3, 2016 22:08
Express + Bootstrap 3 + Galleria
/*
* main.js is the server for ardeshir.org
*
*/
'use strict';
var
http = require('http'),
express = require('express'),
@ardeshir
ardeshir / db.c
Created February 9, 2014 19:05
in memory database of objects
#include <stdio.h> // declares printf(), scanf(), and fpurge()
#include <stdlib.h> // declares malloc(), realloc()
#include <stdbool.h> // declares bool.
#include <string.h> // declares strcmp()
#include <ctype.h>
struct dbCD {
char artist[40];
char composer[40];
@ardeshir
ardeshir / reflection.js
Last active August 29, 2015 13:56
JS Reflection
var obj_data = { FirstName : 'JavaScript',
LastName : 'ECMAScript 5',
Middle: ['scheme','the fool','sunshine'],
Phone: [ '612.666.0300', { home: '763.521.0504',
work: ['123.123.1234','123.444.5555'],
cell: '01.123.555.6677'
}
],
Address : {
Street: '3753 20th Ave South',
@ardeshir
ardeshir / is_prm.py
Created February 17, 2014 21:25
Prime
from math import sqrt
def is_prm(x):
if x < 2:
return False
for i in range(2, int(sqrt(x)) + 1):
if x % i == 0:
return False
return True
@ardeshir
ardeshir / obj.js
Created February 17, 2014 21:28
obj
var obj = {
FirstName : 'JavaScript',
LastName : 'ECMAScript 5',
Middle: ['scheme','the fool','sunshine'],
Phone: [ '612.666.0300', { home: '763.521.0504',
work: ['123.123.1234','123.444.5555'],
cell: '01.123.555.6677'
}
],
@ardeshir
ardeshir / repl.c
Last active August 29, 2015 14:01
#include "mpc.h"
#ifdef _WIN32
static char buffer[2048];
char* readline(char* prompt) {
fputs(prompt, stdout);
fgets(buffer, 2048, stdin);
char* cpy = malloc(strlen(buffer)+1);
package main
import (
"log"
"fmt"
"database/sql"
_ "github.com/go-sql-driver/mysql"
)