Skip to content

Instantly share code, notes, and snippets.

View mgara's full-sized avatar
🎯
Focusing

Meher mgara

🎯
Focusing
  • Meher Gara Consulting
  • Montreal
  • 07:10 (UTC -04:00)
View GitHub Profile
@mgara
mgara / live.html
Created August 4, 2023 14:10
Google sports, live animation for scoring
<!DOCTYPE html>
<html>
<head>
<style>
.ball {
width: 150px;
height: 50px;
position: relative;
background-color: green;
animation: mymove 2s infinite;
@mgara
mgara / gist:eb1489b9a3d851c3997f53c199c7d5e4
Created July 24, 2020 15:20
Credit Card Test Numbers
//eslint-disable-next-line
const TEST_CARDS = [
// cybersource
"378282246310005",
"6011111111111117",
"3566111111111113",
"50339619890917",
"586824160825533338",
"6759411100000008",
"6759560045005727054",
@mgara
mgara / loadcss.js
Created December 5, 2017 15:21
Load CSS dynamically with callback
$.extend({
getCss: function(urls, callback, nocache){
if (typeof nocache=='undefined') nocache=false; // default don't refresh
$.when(
$.each(urls, function(i, url){
if (nocache) url += '?_ts=' + new Date().getTime(); // refresh?
$.ajax({
url: url,
cache: false,
success: function(){
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@mgara
mgara / graphite-client.py
Last active July 20, 2016 14:26 — forked from codification/graphite-client.py
Graphite client in python
import time
import socket
def collect_metric(name, value, timestamp):
sock = socket.socket()
sock.connect( ("localhost", 2003) )
sock.send("%s %f %f\n" % (name, value, timestamp))
sock.close()
def now():
return int(time.time())
@mgara
mgara / decorators.py
Created June 9, 2016 15:04 — forked from codeinthehole/decorators.py
Basic auth for Django snippet
import base64
from django.http import HttpResponse
from django.contrib.auth import authenticate
from django.conf import settings
def view_or_basicauth(view, request, *args, **kwargs):
# Check for valid basic auth header
if 'HTTP_AUTHORIZATION' in request.META:
@mgara
mgara / pysyslog.py
Created January 28, 2016 17:08 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
# Tiny Syslog Server in Python.
##
# This is a tiny syslog server that is able to receive UDP based syslog
# entries on a specified port and save them to a file.
# That's it... it does nothing else...
# There are a few configuration parameters.
# create a ramdisk if you want to use stoe logs on the ram disk. (faster thant