This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{8}' | xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = "0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc" | |
#DEFINE_GUID(IID_IScriptControl, 0x8b167d60, 0x8605, 0x11d0, | |
# 0xab, 0xcb, 0x00, 0xa0, 0xc9, 0x0f, 0xff, 0xc0); | |
#"0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s" % ( s[0:8], s[9:13], s[14:18], s[19:21] | |
arr = [8,4,4,2,2,2,2,2,2,2,2] | |
print "DEFINE_GUID(IID_IXXX," + ','.join( map( lambda kv: '0x' + s.replace('-','')[ sum(arr[:kv[0]]) : sum(arr[:kv[0]]) + kv[1] ], enumerate(arr) ) ) + ");" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
if [ $# -ne 2 ]; then | |
echo $0: usage: myscript databasename zipfile | |
exit 1 | |
fi | |
dbname=$1 | |
psql --command "select pg_terminate_backend(procpid) from pg_stat_activity where datname = '$dbname';" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
import argparse | |
def copy_table( connectionStringSrc, connectionStringDst, table_name, verbose=False, condition="" ): | |
with psycopg2.connect(connectionStringSrc) as connSrc: | |
with psycopg2.connect(connectionStringDst) as connDst: | |
query = "SELECT * FROM {} {};".format(table_name,condition) | |
with connSrc.cursor() as curSrc: | |
curSrc.execute( query ) | |
print "Source number of rows =", curSrc.rowcount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lxml.etree as ET | |
import argparse | |
parser = argparse.ArgumentParser(description='XSLT Transform XML file.') | |
parser.add_argument('xml', help='input xml file') | |
parser.add_argument('xsl', help='input xslt file') | |
parser.add_argument('-o', '--output', help='Output file') | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Validation CalcDiffMean" | |
] | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
^ DS3231 ^Arduino ^ | |
| SCL | 12 SCL | | |
| SDA | 11 SDA | | |
| VCC | VCC | | |
| GND | GND | | |
*/ | |
#include "Wire.h" | |
#define DS3231_I2C_ADDRESS 0x68 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct, time, zlib | |
def generate_gzip(): | |
# Migration Python2 to 3 https://stackoverflow.com/a/44387566/2137364 | |
# Yield a gzip file header first. | |
yield ( | |
b'\037\213\010\000' + # Gzip file, deflate, no filename | |
struct.pack('<L', int(time.time())) + # compression start time | |
b'\002\377' # maximum compression, no OS specified | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Correction problem when upgrade package link | |
# /sbin/ldconfig.real: /usr/lib/libQt5Widgets.so.5 is not a symbolic link | |
# run program output command line to execute with sudo | |
for file in /usr/lib/*; do | |
if [[ ! -L "$file" && ! -d "$file" ]] | |
then | |
pattern="(.*so)\." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paho.mqtt.client as mqtt | |
import sys | |
import json | |
from random import random | |
import ssl | |
import os | |
# This is the Publisher | |
data = json.dumps({ | |
'temperature' : random() * 20.0, |
OlderNewer