Skip to content

Instantly share code, notes, and snippets.

View marianmoldovan's full-sized avatar

Marian C Moldovan marianmoldovan

View GitHub Profile
@marianmoldovan
marianmoldovan / gist:328310672643b37775b0
Created September 15, 2014 09:55
Resize images with sips [MAC OS]
sips --setProperty format png -z 90 90 ./*.jpg --out pngs
import pymongo
from scrapy.exceptions import DropItem
from scrapy.conf import settings
from scrapy import log
class MongoDBPipeline(object):
def __init__(self):
connection = pymongo.Connection(settings['MONGODB_SERVER'], settings['MONGODB_PORT'])
db = connection[settings['MONGODB_DB']]
self.collection = db[settings['MONGODB_COLLECTION']]
@marianmoldovan
marianmoldovan / gist:386691a06aeef1d3acbb
Created June 27, 2015 12:37
Connect manually to Wifi AP Debian
sudo vi /etc/network/interfaces
#add this to the file
auto wlan0
iface wlan0 inet dhcp
wpa-ssid {ssid}
wpa-psk {password}
After that write and close file and use command:
#finally restart
@marianmoldovan
marianmoldovan / wificheck.sh
Created September 8, 2015 15:05
Wifi check script raspberry pi rpi
#!/bin/bash
# The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8
# Only send two pings, sending output to /dev/null
ping -c2 ${SERVER} > /dev/null
# If the return code from ping ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
@marianmoldovan
marianmoldovan / index.js
Created January 18, 2017 10:37
AWS Lambda Rekognition API
'use strict';
const request = require('request').defaults({ encoding: null });
const aws = require('aws-sdk');
const rekognition = new aws.Rekognition({region: 'eu-west-1'});
exports.handler = function(event, context, callback) {
request(event.url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var params = {
@marianmoldovan
marianmoldovan / index.js
Created January 18, 2017 10:52
AWS Polly Lambda API
'use strict';
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
const polly = new aws.Polly({region: 'eu-west-1'});
const md5 = require('md5');
const request = require('request');
var params = {
OutputFormat: 'mp3',
Text: 'Hola',
@marianmoldovan
marianmoldovan / main.py
Created April 9, 2018 20:26
HID Trinket M0 close tab and window hack
import digitalio
from board import *
import time
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
# the keyboard object!
kbd = Keyboard()
button = digitalio.DigitalInOut(D0)
{
"resourceType": "Bundle",
"identifier": {
"use": "official",
"value": "DIGA",
"period": {
"start": "2021-10-08T11:27:40.146Z"
}
},
"type": "collection",