Skip to content

Instantly share code, notes, and snippets.

@piatra
piatra / kafka_start.sh
Last active May 28, 2023 19:18
start zookeeper and kafka in the background and create a topic
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Please supply topic name"
exit 1
fi
nohup bin/zookeeper-server-start.sh -daemon config/zookeeper.properties > /dev/null 2>&1 &
sleep 2
nohup bin/kafka-server-start.sh -daemon config/server.properties > /dev/null 2>&1 &
@piatra
piatra / probability.hs
Created December 19, 2015 21:26
Working with probabilities in Haskell
{-# LANGUAGE TypeFamilies,
GeneralizedNewtypeDeriving #-}
-- Example based on http://www.randomhacks.net/2007/02/21/randomly-sampled-distributions/
module NewEx where
import Control.Monad
import Control.Monad.Trans
import Data.List
@piatra
piatra / index.html
Created April 29, 2012 11:47
Record stream from getUserMedia() stream
<!DOCTYPE HTML>
<html>
<head>
<title>Video recording demo</title>
<link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
@piatra
piatra / kfifo_example.c
Created October 28, 2015 19:09
Using kfifo linux api
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/kfifo.h>
MODULE_DESCRIPTION("Kfifo test");
MODULE_AUTHOR("Victor Andrei Oprea");
MODULE_LICENSE("GPL");
@piatra
piatra / patch.diff
Last active July 18, 2020 09:22
wip bug 1618356
diff --git a/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js b/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
index 7aff1422288a..6809d0093617 100644
--- a/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
+++ b/toolkit/components/messaging-system/schemas/SpecialMessageActionSchemas/test/browser/browser_sma_docs.js
@@ -18,7 +18,7 @@ add_task(async function test_sma_docs() {
let request = await fetch(TEST_URL);
let docs = await request.text();
let headings = getHeadingsFromDocs(docs);
- const schemaTypes = (await fetchSMASchema).anyOf.map(
+ const schemaTypes = (await fetchSMASchema()).anyOf.map(
Some comments about the targeting:
1. WNP_MOMENTS_MOBILE
* firefox version 70+ (70 _or more_)
* tier 1 and 14 days old profile
* isFxAEnabled && sync.mobileDevices == 0
* this isn't 100% correct
* it means: user did not turn of sync AND did not sync any mobile devices, BUT it doesn't check if the user is
signed in to FxA. This targeting expression includes both users logged in to FxA AND not logged in who do not
have a mobile device synced.
* I _think_ it should have included "is signed in to FxA"
@piatra
piatra / peerjsdemo.html
Created April 12, 2014 09:08
peer js demo
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<button>connect</button>
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/AboutNewTabService.jsm
index 69390dfbc8a2..30796b29f398 100644
--- a/browser/components/newtab/AboutNewTabService.jsm
+++ b/browser/components/newtab/AboutNewTabService.jsm
@@ -23,6 +23,13 @@ ChromeUtils.defineModuleGetter(
"AboutNewTab",
"resource:///modules/AboutNewTab.jsm"
);
+const PREF_SEPARATE_ABOUT_WELCOME = "browser.aboutwelcome.enabled";
+XPCOMUtils.defineLazyPreferenceGetter(
@piatra
piatra / customElement.js
Created February 19, 2020 14:34
Use a DOMLocalization instance separate from document.l10n
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// This is loaded into all XUL windows. Wrap in a block to prevent
// leaking to window scope.
{
const { RemoteL10n } = ChromeUtils.import(
@piatra
piatra / gist:4e82de4cf9158d73ec49
Created December 10, 2014 13:48
ubuntu 13.04 sources.list
deb http://www.mirrorservice.org/sites/packages.linuxmint.com/packages/ olivia main upstream import
deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ raring-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ raring partner