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
# Module declaration | |
defmodule :xmerl_xml_indent do | |
@moduledoc """ | |
Erlang OTP's built-in xmerl library lacks functionality to print XML with indent. | |
To work around this, we must create a custom callback to indent XML. | |
This callback is taken from https://github.com/erlang/otp/blob/master/lib/xmerl/src/xmerl_xml.erl | |
The code is converted to Elixir and modified for indentation. | |
This callback works only if the original XML string is a one-liner without identation. | |
""" |
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
##### start of rpicenter library code ##### | |
from abc import ABCMeta, abstractmethod | |
from threading import Thread | |
class Adapter(): | |
def __init__(self, device_object_id, slot, gpio_pin): | |
self._device_object_id = device_object_id | |
self._slot = slot | |
self._gpio_pin = gpio_pin |
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
### what this script does: | |
### 1. get the ip of the machine, check whether hdmi is plugged | |
### 2. send the ip by email | |
### 3. repeat step 1 and 2 several times | |
### 4. if step 3 ok, quit | |
### 5. if step 3 not ok, in X second check flag file auto_shutdown_1 exists | |
### 6. if flag file exists, shutdown | |
## user config ## |
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 psycopg2.extras | |
import sys | |
import time | |
conn = None | |
class Generic: | |
pass |
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
from sqlalchemy import create_engine | |
import sys | |
import time | |
conn = None | |
class Generic: | |
pass | |
try: |
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
from sqlalchemy import create_engine | |
conn = None | |
try: | |
conn_str = "postgresql+psycopg2://postgres:password@localhost:5432/test" | |
engine = create_engine(conn_str, pool_size=3) | |
conn = engine.connect() | |
for i in range(0, 100000): | |
sql = "insert into table1 (a,b,c,d,e) values (%s,%s,%s,%s,%s)" | |
conn.execute(sql, (i, 'string for ' + str(i), 'string for ' + str(i), i*0.1, i*0.1)) | |
finally: |
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
set quoted_identifier off | |
set nocount on | |
go | |
alter proc util_gen_insert | |
@tbl_name varchar(100) | |
, @where_clause varchar(max) | |
as | |
begin |