Blog

  • go-utls

    go-utls

    Utilities for Go

    GitHub tag (latest by date) GitHub last commit GitHub issues GitHub

    go-utls is a small Go repository where I put all the useful stuff I regularly need in my projects. Feel free to use at your discretion with the appropriate license mentions.

    NB: I’ve developed the same kind of libraries for TypeScript and Python.

    Usage

    go get github.com/cyrildever/go-utls

    This repository contains the following modules:

    • crypto: a proxy to Go-Ethereum’s ECIES library and to my ecies-geth JavaScript library (including the Path type) as well as a small SSHPublicKey2String() utility;
    • io: a light REST client utility on top of fasthttp with Delete, Get, Patch, Post and Put methods;
    • model: a list of types I frequently use in my projects (such as Base64 or Hash types) all implementing my Model interface;
    • normalizer: the adaptation of my Empreinte Sociométrique™ patented work for normalizing contact data (see its specific README or use its TypeScript equivalent on NPM: es-normalizer);
    • a few utility sub-modules:
      • caller: to get information about the location of the calling function (file name and line number);
      • concurrent: to handle concurrent maps and slices (with faster slice appending when its length is set at instantiation through the concurrent.NewSlice function);
      • email: my “quick-and-dirty” SMTP client (including examples in tests for use with AWS SES or Gmail);
      • env: to know if an environment variable is set and cast it as either a boolean, an integer or a string (potentially setting it with a default value);
      • event: a simple event bus manager;
      • file: to find, truncate, know existence, delete, get line count or read all lines from a file;
      • logger: a wrapper to the log package to output logs to stderr and optionally a file;
      • ntp: another small wrapper to handle time with NTP;
      • packer: to marshal/unmarshal data (JSON, MessagePack, MongoDB’s Bson, …);
      • utils: a bunch of useful utility functions (Capitalize(), Chunk(), DateFormat() from Java notation, EuclideanDivision(), Flatten(), FromHex()/ToHex(), back-and-forth conversions of byte arrays (to string, number, etc.), IsPointer()/IsValue() test methods, PrettyPrintJSON(), Reverse() for strings, ToUTF8() string formatting, …);
      • xor: to apply XOR operation to strings or byte arrays.

    License

    These modules are distributed under a MIT license.
    See the LICENSE file.


    © 2020-2025 Cyril Dever. All rights reserved.
    Visit original content creator repository https://github.com/cyrildever/go-utls
  • square1

    Square1

    A very simple image slider that will responsively work with images of any size or shape.
    requires jQuery

    Installation

    1. Link to jQuery

       <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
      
    2. Link to the Square1 JS and CSS

       <link rel="Stylesheet" href="https://github.com/thomhines/square1/square1.min.css" type="text/css" />
       <script src="square1/square1.min.js"></script>
      
    3. Turn your images into a slideshow

      HTML:

      You can create a slideshow from a list of images:

       <div class="slideshow">
       	<img src="https://github.com/thomhines/image1.png" alt="Caption 1">
       	<img data-src="image2.png" alt="Caption 2">
       	<img data-src="image3.png" alt="Caption 3">
       </div>
      

      Note: Appending data- to the ‘src’ and ‘srcset’ attributes will enable async loading (eg. data-src=”https://github.com/thomhines/image1.png”).

      OR, you can include slides as HTML content elements. The img tag inside the slide will be used as the slide’s background:

       <div class="slideshow">
       	<div>
       		<img src="https://github.com/thomhines/image1.png" alt="Caption 1">
       		<h3>Slide Title</h3>
       	</div>
       	<div>
       		<img src="image2.png" alt="Caption 2">
       		<h3>Slide Title</h3>
       	</div>
       	<div>
       		<img src="image3.png" alt="Caption 3">
       		<h3>Slide Title</h3>
       	</div>
       </div>
      

      Additionally, if you are using the default “cover” fill mode to scale your images, you can set the point from which the image should scale from by adding the ‘scale-from’ attribute to your images. You can use any values that work with the CSS background-position property.

       <img src="https://github.com/thomhines/image1.png" alt="Caption 1" scale-from="right top">
       <img data-src="image2.png" alt="Caption 2" scale-from="center bottom">
       <img data-src="image3.png" alt="Caption 3" scale-from="left bottom">
      

      JS:

       $(function() {
       	$('.slideshow').square1();
       });
      

    Slideshow Options

    All modifications to how the slideshow runs are optional. To change the default behavior, simply add the options you want to change to the square1() function like so:

    $('.slideshow').square1({
    	slide_duration: 8000,
    	dots_nav: 'hover'
    });
    

    Here are all of the options with their default values:

    width: 			$(_this).width(), 	// options: any CSS measurement. Blank values will default to whatever is set in CSS, or 'auto' if no CSS is set.
    height: 		$(_this).height(),  	// options: any CSS measurement. Blank values will default to whatever is set in CSS, or the height of the first image if no CSS is set.
    animation: 		'fade', 		// Transition animation style. Values: 'fade' or 'slide'
    fill_mode: 		'cover', 		// Determines how images fill slideshow. Values: 'contain', 'cover', or pixel/percent value
    scale_from: 		'center', 		// Values: all values that work for CSS background-position property (eg. 'right bottom', '100px 300px', etc.). Default set to 'center center' in CSS
    background:		'none',			// Set slideshow background color. Values: any CSS color or valid CSS background value
    auto_start: 		true,			// Set whether slideshow autoplays or not. Values: true/false
    start_delay: 		0, 			// If auto_start is true, set how long to wait before slideshow starts. Values: ms
    slide_duration: 	4000, 			// Amount of time each slide is shown before progressing to next. Values: ms
    transition_time: 	500, 			// Amount of time it takes to transition from one slie to next. Values: ms
    pause_on_hover: 	true,			// Pause autoplay if user hovers mouse over slideshow. Values: true/valse
    keyboard: 		true,			// Allow users to control slideshow with arrow keys. Will automatically add slideshows into keyboard tab order. Values: true/valse
    gestures: 		true,			// Allow users to control slideshow with touch gestures (swipe left/right). Values: true/valse
    lazy_load: 		false,			// Enabling this will load images as they are needed instead of on page load
    theme:			'dark',			// Set color palette of slideshow UI elements. Values: 'dark', 'light'
    prev_next_nav: 		'inside', 		// How to display (or not) the arrow nav buttons. Values: 'inside', 'outside', 'hover', 'none'
    dots_nav: 		'inside', 		// How to display (or not) the dot nav buttons. Values: 'inside', 'outside', 'hover', 'none'
    caption: 		'outside', 		// How to display (or not) image captions. Values: 'inside', 'outside', 'hover', 'none'
    
    // Callback functions
    onLoad: 		function() {},		// Triggered when slideshow has completed loading
    onPlay: 		function() {},		// Triggered when slideshow starts playing
    onStop: 		function() {},		// Triggered when slideshow stops playing
    onChange: 		function() {}		// Triggered after slide has changed
    

    Slideshow Remote Control Functions

    You can also control any Square1 slideshow remotely via JS:

    // Start slideshow
    $('.slideshow').square1('play');
    
    // Stop slideshow
    $('.slideshow').square1('stop');
    
    // Go to next slide
    $('.slideshow').square1('next');
    
    // Go to previous slide
    $('.slideshow').square1('prev');
    
    // Jump to slide N (or any integer);
    $('.slideshow').square1(5);
    

    Other Settings

    If you are using the default “cover” fill mode to scale your images, you can set the point from which the image should scale from (ie. which corner of the image will be pinned in place if parts of the image need to be scaled and cropped). You can use any values that work with the CSS background-position property.

    And you can set this on an image-by-image basis by adding the ‘scale-from’ attribute to your images (resize your browser to see the result):

    <img src="https://github.com/thomhines/image1.png" alt="Caption 1" scale-from="top left" scale-from-mobile="bottom center">
    

    Thanks

    Thanks to http://isorepublic.com/ for the images

    Visit original content creator repository
    https://github.com/thomhines/square1

  • labeler

    ATproto labeler

    This is an implementation of a basic labeler. It does not have any UI and does not impose any workflow on you.
    Labels can be created via an API, or any other way you implement.

    Getting started

    1. Clone this repository.
    2. Copy example.env to .env and at the very least uncomment and edit DATA_DIR variable there.
    3. Copy example_config.yaml to config.yaml. Generate and put there a private key. Edit or simply remove everything after the line with the private key.
    4. Run docker compose up --build -d

    Congratulations! You’ve got yourself a perfectly useless labeler 🙂 (by default there’s no way to create any labels)

    Enabling a simple API

    Copy docker-compose.override.example.yaml to docker-compose.override.yaml and run docker compose up -d.

    Now you can create labels by sending them as a POST request to http://127.0.0.1:8081/label, e.g.:

    curl -X POST --json '{"uri": "did:plc:foobar","val": "!hide"}' http://127.0.0.1:8081/label

    Note that there’s no authentication whatsoever, so you should not expose this port to outside world.
    This API is intended only as an example. If you insist on using it anyway – at least put it behind
    a reverse proxy with authentication.

    Setting up the labeler account to actually work

    For someone to be able to subscribe to your labeler and see the labels, two things need to happen:

    1. Labeler service record need to exist in the PDS.
    2. DID document needs to have labeler’s signing key and service endpoint.

    Updating PLC

    1. Ensure that you have did, password, private_key and endpoint set in your config.
    2. While your labeler is running, run docker compose exec labeler ./update-plc --config=/config.yaml.
    3. If any changes are needed, you will see a message stating that. Wait for the email with the token and re-run the same command, but add --token flag

    Updating labeler service record

    labeler and list-labeler automatically do it at startup. Just make sure that in your config
    you have labels set up the way you want them, and that did and password are specified too.

    Migrating from Ozone

    Warning

    This wasn’t tested yet on any live instance, please report any issues if you do this.

    Warning

    I reiterate – there’s no web UI of any kind in this repo, you need to bring
    your own before switching from Ozone if you plan to do any manual labeling.

    cmd/clone implements making a copy of a labeler with the same sequence numbers, so cursor values
    any consumers have will remain valid and point to the same data.

    1. Keep Ozone running, but ensure that no new changes are happening.
    2. docker compose run --entrypoint=./clone labeler --config=/config.yaml --from=https://your.ozone.instance
    3. If it completes without errors, start your labeler with docker compose up -d

    Labeling accounts based on a mute list

    There’s an implementation of a labeler that takes a list and converts it into a label in cmd/list-labeler directory.

    1. Add lists entry to your config file. It should be a mapping from label name to a list URI.
    2. Copy docker-compose.override.example.yaml to docker-compose.override.yaml, if you haven’t yet.
    3. Uncomment entrypoint line and comment out admin API from both ports and command sections.
    4. Ensure that you have did and password set in your config file.
    5. Run docker compose up -d.

    One caveat is that it uses app.bsky.graph.getList call to fetch the list members. Due to that, if someone blocks your account – they won’t be returned in the response and list-labeler would think that they have been removed from the list.

    Further customization

    You can use cmd/labeler as a starting point for implementing your own labeler. You don’t necessarily even need to fork this repo. Just copy cmd/labeler/main.go and import bsky.watch/labeler module.

    Visit original content creator repository
    https://github.com/bsky-watch/labeler

  • whichtool

    whichtool

    Which tool from the Society for Internet Blaseball Research is right for your needs?

    Accepting PRs – contact @Kawa#7680 in #projects in SIBR for help or questions, and check out the issue tracker for braindumps.

    This is being built using the Sugarcube story format; refer to that link for most syntax questions. Github Pages should auto-compile changes from the src directory into WhichTool.html then push here; refer to Em LazerWalker’s excellent blog on the subject for more info on how that works.

    Adding your own tools

    Create a new .twee file in the src\tools directory, titled after your tool. Here’s a format to follow:

    :: YourToolName
    
    [[This tool|https://whatever.sibr.dev]] does {things and stuff.} {Here's some notes on how to use it.}
    
    It's made by {this user!} The source code is [[here|https://github.com/me/mytool]]. 
    
    If you'd like, you can also [[send {this user} a Ko-Fi|https://ko-fi.com/me]].
    
    <<include WhereToDiscuss>>
    

    The first line must start with the double colon :: and then a short word or phrase. It is easiest if this phrase (the name of the passage) doesn’t have spaces, and Kawa is generally preferring for this name to be in UpperCamelCase.

    Remove {curly braces} and fill them with text. Keep the [[double square braces]] in that format – those will make links; left of the | pipe is the text, that links to the site on the right. Be sure to include the full site name (with the https://!) You’re of course not required to use precisely this format, or necessarily share your source or support links – do what feels right for your tool.

    The final line auto-includes boilerplate on where to discuss issues for your project. It should default to the main #📽-Projects channel in “🙌 Getting Involved”. If you have your own 💼 Major Projects channel, you’ll need an extra line – <<set $discussion_channel to "my-channel">> before the include. (Kawa can help with some of the subtleties of variable flagging in Twine.)

    If you’re comfortable with Twee, you can also edit main.twee to lead to a link to a passage called YourToolName where your tool should go in the main flow. It’s okay if you’re not comfortable with editing the main flow – submit a pull request anyway, and Kawa will help make that happen!

    If you have questions, just ask Kawa, either by an @-mention in #projects or opening an Issue here.

    Currently existing tool makers are welcome to edit their own tools’ .twee files as well!

    An arbitrary style note

    Kawa demarcates Discord channel names using the .channel style; you can wrap a channel like so:

    @@.channel;#channel-name-here@@
    

    If you have AutoHotKey, you can use the script in this repo – +ch will ‘autocorrect’ to @@.channel;#@@, ready to be edited accordingly.

    Local Testing

    Install Tweego then in a command line
    tweego src -o WhichTool.html --head=headers.html
    and test WhichTool.html in your favorite browser.

    Yo can also do
    tweego -w src -o WhichTool.html --head=headers.html
    and have the HTML auto-recompile each time you save anything in src.

    Kawa requests that HTML changes be discarded before pushing to main, to not interfere with Github Actions doing the same thing during its build process.

    Visit original content creator repository
    https://github.com/kawa-kitsuragi/whichtool

  • ContestHub

    ContestHub

    Welcome to ContestHub, the ultimate platform where innovation meets recognition! ContestHub is a dynamic and user-friendly Project Contest Creation Platform designed to foster creativity, engage communities, and celebrate talent across various domains. Whether you’re organizing a design competition, coding challenge, or any other creative contest, ContestHub is your go-to destination for seamless contest creation and efficient winner selection.

    Admin Credentials

    Key Features

    • User-Friendly Interface: Intuitive design and easy navigation for creating and managing contests.
    • Versatile Contest Creation: Supports a wide range of contest types including design, coding, writing, and more.
    • Efficient Winner Selection: Built-in tools for judging, voting, and selecting winners based on customizable criteria.
    • Community Engagement: Tools to foster participant interaction and engagement throughout the contest lifecycle.
    • Secure and Scalable: Secure platform architecture with scalable infrastructure to handle contests of any size.
    • Customizable Templates: Pre-built templates for different types of contests to accelerate the setup process.
    • Detailed Analytics: Comprehensive analytics and reporting to track contest performance and participant metrics.
    • Responsive Design: Fully responsive layout ensuring a great experience across all devices.
    • Integrated Communication: Built-in messaging and notification system to keep participants informed.
    • Support for Multimedia: Easily upload and manage images, videos, and documents as part of contest submissions.

    Extra Routes

    • /upcoming: Upcoming Contests
    • /news: Contest News

    Repository Information

    For more details and to contribute, visit our GitHub Repository.

    How to Use ContestHub

    1. Register or Log In: Create an account or log in to your existing account.
    2. Create a Contest: Use the “Create Contest” button to start a new contest. Fill in the details, set rules, and publish it.
    3. Invite Participants: Share your contest URL with potential participants or promote it through social media.
    4. Manage Submissions: Review and manage contest submissions through the admin dashboard.
    5. Select Winners: Use our judging tools or allow public voting to select winners.
    6. Announce Results: Publish the results and notify participants through the platform.

    Contact Us

    If you have any questions or need support, please reach out to us at support@contesthub.com.

    Visit original content creator repository
    https://github.com/kazifahim7/Assignment-12