Using DNS for challenge
certbot -d foo.bar.com --manual --prefered-challenges dns certonlyApache Cert Config
SSLCertificateFile /etc/letsencrypt/live/foo.bar.com/fullchain.pemSSLCertificateKeyFile /etc/letsencrypt/live/foo.bar.com/privkey.pem
sudo -- bash -c 'docker volume rm $(docker volume ls -f dangling=true -q)' > /dev/null 2>&1
sudo -- bash -c 'docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi' > /dev/null 2>&1
echo $?
import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import java.util.HashMap; import java.util.Map; public class LambdaAPIGateway { public Map<String, Object> handleRequest(Map<String, Object> request, Context context) { LambdaLogger logger = context.getLogger(); logger.log("Function version: " + context.getFunctionVersion() + "; "); logger.log("Event: " + request.toString()); String bodyAsJson = "{\"data\":\"ok\"}"; Map<String, Object> result = Respond(200, bodyAsJson, context); return result; } public static Map<String, Object> Respond(int httpStatus, String bodyAsJson, Context context) { Map<String, Object> retval = new HashMap<>(); /** Response MUST be in a specific format with "headers"; "statusCode" and "body" ONLY Example: { "headers": {"Content-Type":"application/json"}, "body":"...", "statusCode":200 } See http://amzn.to/2lY4oQB (under the heading Output Format of a Lambda Function for Proxy Integration) */ Map<String, Object> headers = new HashMap<>(); headers.put("Content-Type", "application/json"); headers.put("x-request-id", context.getAwsRequestId()); retval.put("headers", headers); retval.put("statusCode", httpStatus); retval.put("body", bodyAsJson); return retval; } }
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_servlet</artifactId>
<version>0.0.6</version>
</dependency>
public class Metrics {
public static final Summary requestLatency = Summary.build()
.name("requests_latency_seconds")
.help("Request latency in seconds.").register();
public static final Counter requestFailures = Counter.build()
.name("requests_failures_total")
.help("Request failures.").register();
public static final Counter requestsTotal = Counter.build()
.name("requests_total")
.help("Request.").register();
public static final Counter uploadedFilesSucceeded = Counter.build()
.name("upload_file_success")
.help("Total files uploaded to S3.").register();
public static final Counter tmpFilesNotCleared = Counter.build()
.name("temp_files_not_cleared")
.help("Total files that could not be removed from cache").register();
}
private final Metrics metrics = new Metrics();
@GET
@Path("/something")
@Produces(MediaType.TEXT_PLAIN)
public String Something() {
try {
Summary.Timer timer = Metrics.requestLatency.startTimer();
// do some work ...
timer.observeDuration();
} catch (Exception e) {
return e.getMessage();
}
return "It works!";
}
@GET
@Path("/metrics")
@Produces(MediaType.TEXT_PLAIN)
public String Metrics() {
StringWriter writer = new StringWriter();
try {
io.prometheus.client.exporter.common.TextFormat.write004(
writer, CollectorRegistry.defaultRegistry.metricFamilySamples());
} catch (Exception e) {
return e.getMessage();
}
return writer.toString();
}
# HELP requests_failures_total Request failures.
# TYPE requests_failures_total counter
requests_failures_total 0.0
# HELP temp_files_not_cleared Total files that could not be removed from cache
# TYPE temp_files_not_cleared counter
temp_files_not_cleared 0.0
# HELP requests_latency_seconds Request latency in seconds.
# TYPE requests_latency_seconds summary
requests_latency_seconds_count 0.25
requests_latency_seconds_sum 1.0
# HELP upload_file_success Total file uploaded to S3.
# TYPE upload_file_success counter
upload_file_success 25874588.0
# HELP requests_failures_total Request failures.
# TYPE requests_failures_total counter
requests_failures_total 2.0
with heartbeat_data (source, time) as (
values ('test', now())
),
update_query as (
update dvs_system.heartbeats
set last_beat = heartbeat_data.time
from heartbeat_data
where source_key = heartbeat_data.source
returning true as updated
)
insert into dvs_system.heartbeats (source_key, last_beat)
select source, time
from heartbeat_data
where not exists (
select 1 from update_query where updated = TRUE
)
;
CREATE OR REPLACE FUNCTION app_system.create_request_log_partition(_date timestamp without time zone)
RETURNS void AS
$BODY$
DECLARE
_table text := format('request_log_%s_q%s', date_part('year', _date), date_part('quarter', _date));
BEGIN
EXECUTE
'CREATE TABLE system.'|| _table ||'() INHERITS (system.access_log);'||E'\n'
||'CREATE INDEX '|| _table ||'_created_idx ON system.'|| _table ||'(created_at);'||E'\n'
||'CREATE INDEX '|| _table ||'_api_request_idx ON system.'|| _table ||'(api_request);'||E'\n'
||'GRANT INSERT, SELECT ON system.'|| _table ||' TO myapp;'||E'\n'
;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION app_system.create_request_log_partition(timestamp without time zone) OWNER TO postgres;
cd /etc/ssl
openssl req -x509 -new -nodes -newkey rsa:2048 -keyout haproxy.key -out haproxy.crt
cat ./haproxy.crt ./haproxy.key > ./haproxy.pem
1: #!/usr/bin/env bash
2:
3: # Get the git branch / tag name
4:
5: # first, see of we have branch information (this will not be available if we checked out a tag)
6: TAG_OR_BRANCH="$(git rev-parse --abbrev-ref HEAD | egrep -o '([0-9]{1,}\.)+[0-9]{1,}')"
7:
8: if [ "$TAG_OR_BRANCH" == "" ]; then
9:
10: # if we can't get branch info, then we must be in a tag, so use that
11: TAG_OR_BRANCH="$(git describe | egrep -o '([0-9]{1,}\.)+[0-9]{1,}+(-b[0-9]{1,})')"
12: fi
13:
14: # Remove the version from the properties file
15: sed -i '/^version=/ d' src/main/resources/static/version
16:
17: # Add the version to the properties file
18: echo "Writing version $TAG_OR_BRANCH"
19: echo "version=$TAG_OR_BRANCH" >> src/main/resources/static/version
WITH models AS (
WITH data AS (
SELECT
replace(initcap(table_name::text), '_', '') table_name,
replace(initcap(column_name::text), '_', '') column_name,
CASE data_type
WHEN 'timestamp without time zone' THEN 'time.Time'
WHEN 'timestamp with time zone' THEN 'time.Time'
WHEN 'boolean' THEN 'bool'
-- add your own type converters as needed or it will default to 'string'
ELSE 'string'
END AS type_info,
'`json:"' || column_name ||'"`' AS annotation
FROM information_schema.columns
WHERE table_schema IN ('dvs_app', 'dvs_system')
ORDER BY table_schema, table_name, ordinal_position
)
SELECT table_name, STRING_AGG(E'\t' || column_name || E'\t' || type_info || E'\t' || annotation, E'\n') fields
FROM data
GROUP BY table_name
)
SELECT 'type ' || table_name || E' struct {\n' || fields || E'\n}' models
FROM models ORDER BY 1
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
yum install opensc pcsc-lite |
wget http://download.fh-swf.de/dvz/software/eToken/Linux/Software/SafeNetAuthenticationClient_Linux_8_1.1.zipunzip SafeNetAuthenticationClient_Linux_8_1.1.zipcd SAC\ 8.1\ Linux/x86_64/unzip SAC_8_1_0_4_Linux_RPM_64.zipcd SAC_8_1_0_4_Linux_RPM_64/Signed\ installation\ scripts/chmod +x signed-install_SafenetAuthenticationClient-8.1.0-4.x86_64.rpm.shcp ../RPM/SafenetAuthenticationClient-8.1.0-4.x86_64.rpm ../signed-install_SafenetAuthenticationClient-8.1.0-4.x86_64.rpm.sh |
Searching SafenetAuthenticationClient-8.1.0-4.x86_64.rpm... OKSearching RPM-GPG-KEY-SafenetAuthenticationClient... OKDeleting existing keyImporting key: RPM-GPG-KEY-SafenetAuthenticationClientStarting installation########################################### [100%]########################################### [100%]Adding Token security provider......done.Starting PC/SC smart card daemon (pcscd): [ OK ]SafeNet Authentication Client installation completed.Choose Client Language:------------------------1. English.....(En)2. Spanish.....(Es)3. French......(Fr)4. Italian.....(It)5. Japanese....(Jp)6. Korean......(Ko)7. Russian.....(Ru)8. Chinese.....(Zh)9. Portoguese..(Pt)10. Thai.......(Th)Your choice [1-10] -->1Installing Language code En.Done! |
opensc-tool --list-readers |
# Detected readers (pcsc)Nr. Card Features Name0 Yes AKS ifdh 00 00Find out which slot the device is in: pkcs11-tool --module /usr/lib64/libeToken.so -L You should see something to the effect of:
|
#!/usr/bin/env python
import re
import os
__dir__ = os.path.dirname(os.path.realpath(__file__))
def cleanup_recursive(_dir=__dir__):
print "Cleaning " + _dir
for _item in os.listdir(_dir):
_path = _dir + "/" + _item
if os.path.isfile(_path) and re.match(".+\.jpg$", _path):
os.remove(_path)
elif os.path.isdir(_path):
cleanup_recursive(_dir)
cleanup_recursive()
/**
DEFINE
*/
CREATE OR REPLACE FUNCTION my_admin_schema.sel_function_containing(_schema_name text, _search_value text)
RETURNS TABLE (
schema text, sproc_name text, arg_names text, return_type text, description text, definition text
) AS
$BODY$
BEGIN
RETURN QUERY
WITH funcs AS (
SELECT
n.nspname::text AS schema
,proname::text AS sproc_name
,proargnames::text AS arg_names
,t.typname::text AS return_type
,d.description
,pg_get_functiondef(p.oid) as definition
FROM pg_proc p
JOIN pg_type t on p.prorettype = t.oid
JOIN pg_description d on p.oid = d.objoid
JOIN pg_namespace n on n.oid = p.pronamespace
WHERE n.nspname = _schema_name
)
SELECT *
FROM funcs
WHERE funcs.definition ~* _search_value
OR funcs.description ~* _search_value
;
END; $BODY$ LANGUAGE plpgsql STABLE COST 100
;;
/**
EXAMPLE USAGE
*/
SELECT * FROM offerpoint_admin1.sel_function_containing('my_app_schema', 'status')
;;