Skip to content

Instantly share code, notes, and snippets.

View meysampg's full-sized avatar
🖖
bit bit 0 bit

Meysam P. Ganji meysampg

🖖
bit bit 0 bit
View GitHub Profile
function Hash(object){
function hash(key, value){
return (
arguments.length === 2 ? hash.set(key, value) :
arguments.length === 1 ? hash.get(key) :
hash.index
);
};
hash.index = {};
for (var p in Hash.prototype) hash[p] = Hash.prototype[p];
{
"errors": {
"0": "تراكنش با موفقيت انجام شد",
"11": "شماره كارت نامعتبر است",
"12": "موجودي كافي نيست",
"13": "رمز نادرست است",
"14": "تعداد دفعات وارد كردن رمز بيش از حد مجاز است",
"15": "كارت نامعتبر است",
"16": "دفعات برداشت وجه بيش از حد مجاز است",
"17": "كاربر از انجام تراكنش منصرف شده است",
@mahdavipanah
mahdavipanah / gsc.sh
Created December 6, 2018 10:13
Zsh function for git checkout and create a branch
function gsc() {
git branch | grep -w "$1" > /dev/null;
if [ $? = 0 ]; then
git checkout "$1";
else
git checkout -b "$1";
fi
}
@sinushx
sinushx / cool-ls.go
Last active May 10, 2019 11:44
a ls-like program in go
package main
import (
"flag"
"fmt"
"github.com/fatih/color"
"log"
"os"
"strconv"
"strings"
<?php
$directories = ['application', 'library', 'database', ''];
define("CWD", dirname(__FILE__));
echo '<h1>Parallel PHP Linter</h1>';
$time_start = microtime(true);
@omidp
omidp / g2j
Created November 13, 2014 08:29
postgresql persian to gregorian function
select g2j(now())
CREATE OR REPLACE FUNCTION g2j(in_date timestamp with time zone)
RETURNS character varying AS
$BODY$
DECLARE
y smallint;
aday smallint;
amonth smallint;
ayear smallint;
@alkos333
alkos333 / gist:1771618
Created February 8, 2012 17:52
Read URL GET variable
// Given a query string "?to=email&why=because&first=John&Last=smith"
// getUrlVar("to") will return "email"
// getUrlVar("last") will return "smith"
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/
function getUrlVar(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
}
@mrzasa
mrzasa / distributed_systems_readings.md
Last active November 9, 2021 02:06 — forked from wenhuizhang/distributed_systems_readings.md
distributed systems readings

#Distributed System Course List

##Systems

  • Cornell CS 614 - Advanced Course in Computer Systems - Ken Birman teaches this course. The readings cover more distributed systems research than is typical (which I am in favour of!). In fact, there's barely anything on traditional internal OS topics like filesystems or memory management. There's some worthwhile commentary at the bottom of the page.

  • Princeton COS 518 - Advanced Operating Systems - short and snappy reading list of two papers per topic, covering some interesting stuff like buffering inside the operating system, and L4.

@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@asmaier
asmaier / KafkaProducerIT.java
Last active March 23, 2022 11:16
Simple java junit test of an apache kafka producer (works with Kafka 0.11.0.2) (see also https://github.com/asmaier/mini-kafka)
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Properties;
import org.I0Itec.zkclient.ZkClient;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;