Skip to content

Instantly share code, notes, and snippets.

View harish2704's full-sized avatar

Harish Karumuthil harish2704

View GitHub Profile
@jerinphilip
jerinphilip / render.py
Last active June 30, 2023 09:35 — forked from santhoshtr/render.py
PangoCairo Text rendering
#!/usr/bin/python3
#-*- coding:utf8 -*-
# Modified for python3
# python2 version https://gist.github.com/santhoshtr/bea3da00651bcd18e282
import cairo
from gi.repository import Gtk, Gdk, Pango, PangoCairo
import cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 100)
context = cairo.Context(surface)
@mizzy
mizzy / node-simple-proxy.js
Created November 6, 2011 09:07
Simple proxy made by node.js
var http = require('http');
var url = require('url');
var proxy = http.createServer(function(req, res) {
var request = url.parse(req.url);
options = {
host: request.hostname,
port: request.port || 80,
path: request.path,
method: req.method,
@harish2704
harish2704 / sendmail.js
Last active May 14, 2022 10:55
Psudo sendmail script for testing
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const mailDir = path.join( __dirname, '..', '..', 'test-mails' );
const {stdin} = process;
async function getStdin() {
let result = '';
<?php header("Content-Type: text/plain"); ?>
<?php header("Content-Disposition: inline"); ?>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
//IMPORTANT: Update the pin and length to match your LED strip!
#define PIN 5
#define LENGTH 150
@creationix
creationix / init.lua
Last active November 1, 2019 11:13
Websocket server in nodemcu using new crypto module.
wifi.setmode(wifi.STATION)
wifi.sta.config("creationix","noderocks")
wifi.sta.connect()
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then
tmr.stop(0)
print(ip)
dofile("websocket.lc")
dofile("main.lc")
@darkxanter
darkxanter / dbus_handler.py
Last active April 21, 2018 09:15
Python DBus handle hibernate, sleep and resume
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'xanter'
#from datetime import datetime
import signal
import time
import dbus
import gobject
import urllib2
@jack-guy
jack-guy / feathers.d.ts
Last active September 7, 2017 10:34
These are basic typings for Feathers.js based off of those in DefinitelyTyped for Express. This doesn't type feathers plugins, but does have some interfaces that can be used in them. WIP.
// Type definitions for Feathers
// Project: http://feathersjs.com/
// Definitions by: Jack Guy <http://thatguyjackguy.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Application, Handler, ErrorRequestHandler } from 'express';
type HandlerArgument = Handler | Handler[];
export = Feathers;
@NickBeeuwsaert
NickBeeuwsaert / printElement.js
Last active March 22, 2017 06:38
This is a chrome snippet to take a screenshot of a element
/**
* NOTE: Because Chrome doesn't elevate the permissions
* of snippets, we can't push the image out to the browser
* using canvas.toDataURL(), we have to add it to the page
* and have the user right-click and save-as
*/
var css = function(el, styles){
for (var style in styles) {
if(!styles.hasOwnProperty(style)) continue;
el.style[style] = styles[style];