Skip to content

Instantly share code, notes, and snippets.

Aswini S ashumeow

Block or report user

Report or block ashumeow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ashumeow
ashumeow / create_file_Qt
Created May 16, 2018 — forked from diniremix/create_file_Qt
create file of text in Qt
View create_file_Qt
void MainWindow::createfile(){
QString filename="test.txt";
QFile file(filename);
if(!file.exists()){
qDebug() << "NO existe el archivo "<<filename;
}else{
qDebug() << filename<<" encontrado...";
}
QString mesg="una segunda linea";
if (file.open(QIODevice::WriteOnly | QIODevice::Text)){
@ashumeow
ashumeow / currency.php
Last active Jan 9, 2018 — forked from daveismyname/gist:8067095
Use Google finance calculator to convert currency with php
View currency.php
<?php
function convertCurrency($amount, $from, $to){
$data = file_get_contents("https://finance.google.com/finance/converter?a=$amount&from=$from&to=$to");
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return number_format(round($converted, 3),2);
}
echo convertCurrency("10.00", "AED", "USD");
?>
@ashumeow
ashumeow / script.php
Last active Mar 30, 2016
Connecting to MySQL database via PHP script
View script.php
<?php
$host = '127.0.0.1';
$user = 'abc';
$pwd = 'abc';
$db = 'xyz';
$con = mysql_connect($host, $user, $pwd) or die("connection failed");
mysql_select_db($db,$con) or die("db selection failed");
@ashumeow
ashumeow / cn
Created Jan 17, 2016
funny-cn-en
View cn
美国联合规划与发展办公室发布
《下一代航空运输系统路线图》
2011 年 9 月, 美国联合规划与发展办公室(Joint Planning and
Development Office,JPDO)发布首份《下一代航空运输系统路线图》,报
告评估了未来美国航空运输系统的长远能力需求,系统介绍了美国航空系
统各单元之间的相互关系,包括通讯、导航、监视、空中交通管理系统和
航空电子设备系统等。报告对下一代航空运输系统的发展提出了设想,并
提出了发展的关键领域。
1. 概述
JPDO 航空工作组制定的航空电子设备路线图规划,为相关组织制定
@ashumeow
ashumeow / GalileoSequencer.ino
Last active Aug 29, 2015 — forked from X-Y/GalileoSequencer.ino
Galileo Sequencer This sketch is used for a demo of the Intel Galileo board. When it was launched in Rome Maker fair 2013, we made a sequencer based on Galileo, SparkFun MP3 shield and the sketch ReadMP3fromSD originally created by Nathan Seidle.
View GalileoSequencer.ino
/*
Galileo Sequencer
This sketch is used for a demo of the Intel Galileo board. When it was launched in Rome Maker fair 2013,
we made a sequencer based on Galileo, SparkFun MP3 shield and the sketch ReadMP3fromSD originally created
by Nathan Seidle.
The sequencer has 2 knobs, 4 buttons and 8 leds on its interface. When activated, it loops through and
plays 8 segments of sound samples repeatedly. At the mean time, the LEDs will light up according to which
segment you’re listening to. You can use the buttons and knobs to customize and add creativity into the sequence.
@ashumeow
ashumeow / move_postgres_data_to_ram.bash
Last active Aug 29, 2015 — forked from zekefast/move_postgres_data_to_ram.bash
Move Postgres data_directory to RAM to improve IO speed and test performance. Run as root/sudo.
View move_postgres_data_to_ram.bash
#!/bin/bash
# It is probably redundant if you set settings mentioned in https://gist.github.com/zekefast/42273658939724ba7c7a .
# But anyway it will not hurt anybody (sure if you are not putting your production database to RAM :)).
#
# Look for more detailed description in follow articles:
# - http://blog.vergiss-blackjack.de/2011/02/run-postgresql-in-a-ram-disk/
#
# ATTENTION:
# DO NOT apply this approach if you store important data in postgresql cluster, because that could cause
View example.js
/**
* file: images.json
*/
{
"images": [
{"title": "Image One", "url": "image1.jpg", "rating": "3.5"},
{"title": "Image Two", "url": "image2.jpg", "rating": "1"},
{"title": "Image Three", "url": "image3.jpg", "rating": "5"}
]
}
View mars.py
import pyscene
scene = pyscene.pyscene()
import osg, osgDB
import math, re, os
scene.setScale(5e4, 0.5)
scene.viewer.getCamera().setClearColor(osg.Vec4f(0, 0, 0, 0))
mars = scene.readNodeFile("mars.osg")
# make the north pole face up instead of down
View 1.README.md

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
View handy.py
#!/usr/bin/env python
import cv2
import numpy as np
def main():
cap = cv2.VideoCapture(0)
while(cap.isOpened()):
ret, img = cap.read()
skinMask = HSVBin(img)
You can’t perform that action at this time.