Skip to content

Instantly share code, notes, and snippets.

Lukasz lukasz-madon

Block or report user

Report or block lukasz-madon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lukasz-madon / send_empty_json.elm
Created Jul 20, 2018
Send an empty json to an endpoint in Elm. Ignore the response
View send_empty_json.elm
sendJson : Cmd Msg
sendJson =
json =
Http.jsonBody (Json.Encode.object [])
Http.send SendEmptyJsonMsg
( "api/empty-json" json (Json.Decode.succeed ""))
View notebook-starter.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lukasz-madon /
Created Mar 7, 2017
Flatten python collection
# following code uses recursion, so it may run out of stack memeory for large collections
def flatten(container):
"""generate a flatten sequence from the input list"""
for i in container:
if isinstance(i, (list, tuple)):
for j in flatten(i):
yield j
yield i
View Preferences.sublime-settings
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
View gist:53a4a89a738ffb7c85e7
/// <summary>
/// Generates AntiForgery Tokens
/// </summary>
public static class AntiForgeryTokensGenerator
private const string ConstantSalt = "b8YagDpYwB";
private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider();
// buffer for random string with 32 bytes of entropy
# -*- coding: utf-8 -*-
"""Convert Unicode text into plain ASCII string."""
# for brevity the table is kept simple
u"\u0394": "D",
u"\u03b1": "a",
u"\u03bd": "n",
u"\u03ac": "a",
u"\u03b7": "e"
View hack.js
"use latest";
let MongoClient = require('mongodb').MongoClient;
const questions = `
<title>Euler problems</title>
View gist:6cdccc543d8c80289d1e
using System;
using System.Linq;
namespace EnumTest
public enum ContentAreaTagEnum
[ContentArea(Name = "Full")]
View gist:508d76d6fd5ff3635494
I wanna write a small tool that will swap music from my youtube video. Currently it's binary
if override_audio:
o_cmd = ["ffmpeg", "-i", music_url, "-i", video_url, "-codec", "copy",
"-y", "-shortest", output_video]
code =
cmd = ["ffmpeg", "-i", music_url, "-i", video_url, "-filter_complex",
"amix=duration=shortest", "-vcodec", "copy", "-y", "-shortest",
View gist:a8da9a6cc09b56803bf9
# given list [2, 3, 5, 78]
# return 1, 4, 6-77, 79-99
# the range is always <1, 100)
def get_ranges(lst, N=100):
s = set(lst)
filtered = (i for i in xrange(1, N) if not i in s)
output2 = []
prev = None
skipping = False
for num in filtered:
You can’t perform that action at this time.