Skip to content

Instantly share code, notes, and snippets.

View japsu's full-sized avatar

Santtu Pajukanta japsu

View GitHub Profile
from straightened import TCPLineProtocol
protocol = TCPLineProtocol()
@protocol.on_line_received
def echo_protocol_line_received(transport, data):
transport.send_line(data)
protocol.listen(9000)
@japsu
japsu / popover.js
Last active August 27, 2015 20:21
Show img[alt] in a Bootstrap 3 popover without any extra markup (doesn't break floats etc)
(function($) {
$('img[alt]').each(function() {
var $this = $(this);
$this
.attr('data-content', $this.attr('alt'))
.hover(function() {
$(this).popover('show');
}, function() {
$(this).popover('hide');
});
@japsu
japsu / DRINK.md
Last active February 19, 2016 12:06
Shannara-juomapeli

The Shannara Chronicles (MTV) -juomapeli

Juodaan, kun

  1. Elfsplaining
  2. Se on kohtalosi
  3. The Dagda Mor
  4. Amberle ja Eretria piikittelevät toisiaan
  5. Amberle tai Eretria on mustasukkainen Wilistä
  6. Muodonmuuttajan silmät välähtävät
- name: tap some homebrew repositories
homebrew_tap: tap={{ item }}
with_items:
- caskroom/cask
- caskroom/versions
- homebrew/dupes
- homebrew/versions
- name: install software via brew
homebrew: name={{ item }}
@japsu
japsu / index.js
Created May 24, 2016 09:35
schemaByExample – generate JSON schema from example object
import _ from 'lodash';
export default function schemaByExample(example) {
if (_.isArray(example)) {
return {
type: 'array',
items: schemaByExample(example[0])
};
} else if (_.isPlainObject(example)) {
@japsu
japsu / README.md
Last active January 2, 2018 17:56
Type-safe Redux reducers in TypeScript using Immutable.js and typed-immutable-record

Type-safe Redux reducers in TypeScript using Immutable.js and typed-immutable-record

Copyright (C) 2017 Leonidas Oy Ltd
Written by <[email protected]>
Licensed under the MIT license

We attempt to harness the friendly API of Immutable.js to build Redux reducers while trying to preserve as much type safety as possible.

State branches are TypedRecords. A combineReducers that outputs TypedRecords is provided.

FROM python:3.6
RUN pip install django-environ==0.4.1
COPY test.py /usr/src/app/test.py
CMD ["python", "/usr/src/app/test.py"]
@japsu
japsu / aws-mfa.py
Last active December 15, 2017 19:00
Authenticate to AWS using MFA and output tokens in a format suitable for `eval $(aws-mfa 666666)`
#!/usr/bin/env python3
import os
import configparser
import sys
import boto3
def main(token_code, serial_number):
@japsu
japsu / aws-config
Last active January 18, 2018 09:22
Get a AWS CLI session with STS role and MFA: `eval $(awssume-role prod 666666)`
[default]
region = eu-central-1
[profile prod]
role_arn = arn:aws:iam::…
source_profile = default
mfa_serial = arn:aws:iam::…
@japsu
japsu / isp.md
Last active February 14, 2018 07:59 — forked from joepie91/vpn.md
Don't use ISP services.

Don't use ISP services.

No, seriously, don't. You're probably reading this because you've asked what ISP service to use, and this is the answer.

Note: The content in this post does not apply to using ISP for their intended purpose; that is, as a premium service delivery mechanism (such as cable, VOD). It only applies to using it as a glorified proxy, which is what every third-party "Internet Service Provider" does.

Why not?

Because an ISP in this sense is just a glorified proxy. The ISP can see all your traffic, and do with it what they want - including logging.