This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // When i needed to proxy both const and non-const iterators, i decided | |
| // to metaprogram and cut the code required in half | |
| template <typename It> | |
| class abstract_iterator | |
| { | |
| It m_iter; | |
| // appropriately const value type | |
| using ValueType = typename | |
| std::conditional< std::is_const<decltype(*m_iter)>::value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from PIL import Image, ImageDraw | |
| import sys | |
| def put_vert_grad(draw, x, start, end, factor, init=(0,0,0)): | |
| for y in range(start - 1, end - 1, -1): | |
| color = tuple(round(ini + y * fac) for fac, ini in zip(factor, init)) | |
| draw.point((x, y), color) | |
| if x == 0 and y == start - 1: | |
| print("vertical gradient is {}".format(color)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Create a pulseaudio rtp stream | |
| # Run a script, then set <rtpcombine> as your default stream, then connect to it from other device | |
| # check if combined sink already exists | |
| pacmd list-sinks | grep -Fq 'name: <rtpcombine>' && echo "Combined stream already exists" && exit 0 | |
| # load rtp modules | |
| pactl load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| class Inclusions | |
| def initialize(filename) | |
| #file stack to remember where we were before | |
| @files = [filename] | |
| #shows if the inclusion map contains no circular inclusions | |
| @status = true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Description: listen for incoming tcp connections, get flags from them, and | |
| # send them to hackerdom's jury server | |
| from socket import create_connection | |
| import socketserver | |
| import re | |
| from sys import stderr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-} | |
| module Main where | |
| import Yesod | |
| import Yesod.WebSockets | |
| import Data.Text (Text) | |
| data MyApp = MyApp | |
| mkYesod "MyApp" [parseRoutes| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "mainwindow.h" | |
| #include <QApplication> | |
| // Description: simple application with intuitive interface. | |
| // It dumps content of clipboard into files. Useful when you have many different content | |
| // types in your clipboard, and want to see them all. | |
| // All output goes into console window, so run from console. | |
| // Requires Qt5Core and Qt5Widgets. Can be built with qmake or cmake (I build with qmake). | |
| int main(int argc, char *argv[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdafx.h" | |
| #include <stdio.h> | |
| #include <windows.h> | |
| #include <Wincrypt.h> | |
| #include <stdexcept> | |
| #include <memory> | |
| #include <iostream> | |
| #include <NCrypt.h> | |
| #include "win32_exception.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| {-# LANGUAGE Rank2Types #-} | |
| module Main where | |
| import Control.Concurrent.MVar (MVar, newMVar, takeMVar, putMVar) | |
| import Control.Monad.State.Strict (runStateT) | |
| import Data.ByteString (ByteString) | |
| import Data.ByteString.Lazy (fromStrict) | |
| import Data.Default (def) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- | A purescript rewrite of this example extension: | |
| -- | https://github.com/mdn/webextensions-examples/tree/master/user-agent-rewriter | |
| module RewriteUa (main) where | |
| import Prelude | |
| import Browser.Event (addListener) | |
| import Data.Options ((:=)) | |
| import Data.String.Common (toLower) | |
| import Effect (Effect) | |
| import Browser.WebRequest |
OlderNewer