Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Obermüller thomas88

View GitHub Profile
@thomas88
thomas88 / transaction.test.ts
Created Jun 6, 2021
Using mongodb transactions with typegoose
View transaction.test.ts
import mongoose from "mongoose";
import { prop as Property, getModelForClass } from "@typegoose/typegoose";
import { withTransaction } from "./transaction";
class Foo {
@Property({ required: true })
example!: string;
}
const FooModel = getModelForClass(Foo);
@thomas88
thomas88 / confluence_pdf.css
Created Jul 26, 2019
Confluence Export PDF Custom Style
View confluence_pdf.css
@page {
size: 210mm 297mm; /* A4-sized pages in portrait orientation; default is US letter */
margin-top: 2.54cm;
margin-bottom: 2.54cm;
margin-left: 1.27cm;
margin-right: 1.27cm;
}
body,p,li,td,table,tr,.bodytext,.stepfield {
font-size: 15px;
@thomas88
thomas88 / result.txt
Created Oct 9, 2018
$ sudo tcpdump -i any -n host 1.1.1.1 and port 53
View result.txt
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
15:29:42.444866 IP 192.168.188.44.60620 > 1.1.1.1.53: 45006+ A? auth.otc.t-systems.com. (40)
15:29:46.660608 IP 1.1.1.1.53 > 192.168.188.44.60620: 45006 ServFail 0/0/0 (40)
15:29:54.959125 IP 192.168.188.44.59598 > 1.1.1.1.53: 42927+ A? serverfault.com. (33)
15:29:54.975230 IP 1.1.1.1.53 > 192.168.188.44.59598: 42927 4/0/0 A 151.101.193.69, A 151.101.1.69, A 151.101.65.69, A 151.101.129.69 (97)
@thomas88
thomas88 / local
Created Oct 9, 2018
dig +trace auth.otc.t-systems.com @1.1.1.1
View local
dig +trace auth.otc.t-systems.com @1.1.1.1
; <<>> DiG 9.10.6 <<>> +trace auth.otc.t-systems.com @1.1.1.1
;; global options: +cmd
. 1003 IN NS b.root-servers.net.
. 1003 IN NS c.root-servers.net.
. 1003 IN NS d.root-servers.net.
. 1003 IN NS e.root-servers.net.
. 1003 IN NS f.root-servers.net.
. 1003 IN NS g.root-servers.net.
@thomas88
thomas88 / hubspot-meetings-conversion-tracking.js
Created Mar 27, 2018
Track conversions of Hubspot Meetings (iframe)
View hubspot-meetings-conversion-tracking.js
function isHubspotUrl(url) {
var hubspotUrls = [
'https://local.hubspot.com',
'https://app.hubspotqa.com',
'https://app.hubspot.com',
'https://meetings.hubspot.com'
];
return hubspotUrls.indexOf(url) > -1
}
View metadata.xml
<?xml version='1.0' encoding='UTF-8'?>
<md:EntityDescriptor xmlns:md='urn:oasis:names:tc:SAML:2.0:metadata' ID='_d43649c1-8d01-4629-b3e3-ed452806463c' entityID='https://api.staging.workpath.com/v1/saml/metadata/ad-test'>
<md:SPSSODescriptor protocolSupportEnumeration='urn:oasis:names:tc:SAML:2.0:protocol' AuthnRequestsSigned='false' WantAssertionsSigned='false'>
<md:SingleLogoutService Binding='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' Location='https://api.staging.workpath.com/v1/saml/logout/ad-test' ResponseLocation='https://api.staging.workpath.com/v1/saml/logout/ad-test'/>
<md:NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
</md:NameIDFormat>
<md:AssertionConsumerService Binding='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' Location='https://api.staging.workpath.com/v1/saml/assert/ad-test' isDefault='true' index='0'/>
</md:SPSSODescriptor>
</md:EntityDescriptor>
@thomas88
thomas88 / index.spec.js
Last active Jun 30, 2016 — forked from boneskull/index.js
example of Mocha source map support for babel (es2015) and markdown reporter
View index.spec.js
import {ok} from 'assert';
describe('foo()', () => {
it('should pass', () => {
ok(true);
});
});
View singleton.js
let instance = null;
class MySingleton {
constructor() {
if(!instance){
instance = this;
}
return instance;
}
@thomas88
thomas88 / delete_duplicates.sql
Created Aug 23, 2013
Delete duplicate entries in a table (fast)
View delete_duplicates.sql
create table tmp like mytable;
alter table tmp engine=MyISAM;
insert into tmp select * from mytable;
alter ignore table tmp add unique index(col1,col2);
alter table tmp engine=InnoDB;
@thomas88
thomas88 / find_duplicates.sql
Created Jul 10, 2013
Find duplicate rows in MySQL (having same value for a column). Replace 'column' and 'table' in statement with values specific to the case.
View find_duplicates.sql
SELECT column, COUNT(*) count FROM table GROUP BY column HAVING count > 1