Skip to content

Instantly share code, notes, and snippets.

View moust's full-sized avatar

Quentin Aupetit moust

  • ReachFive
  • Guadeloupe, France
View GitHub Profile
@tkrs
tkrs / Main.scala
Last active September 17, 2021 21:51
Shapeless automatically derives BigQuery TableSchema from case class
import com.google.api.services.bigquery.model.TableFieldSchema
import com.google.api.services.bigquery.model.TableSchema
import org.joda.time.Instant
import shapeless._
import shapeless.ops.hlist.FillWith
import shapeless.ops.hlist.Mapper
import shapeless.ops.hlist.ToList
import shapeless.ops.record.Keys
import shapeless.ops.record.Values
@aleclarson
aleclarson / rollup-typescript.md
Last active November 4, 2024 15:40
The best Rollup config for TypeScript libraries

It's 2024. You should use tsup instead of this.


Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking

@corsonr
corsonr / woo-restrict-ordersper-day.php
Last active July 6, 2023 02:39
WooCommerce - restrict number of orders per day
<?php
/**
* Plugin Name: Restrict Orders per Day for WooCommerce
* Plugin URI: https://remicorson.com
* Description: Put the shop into catalogue mode once number of orders per day is reached.
* Version: 0.1
* Author: Remi Corson, corsonr
* Author URI: https://remicorson.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
@Stanback
Stanback / ip_conversions.scala
Last active June 10, 2022 10:46
Scala example for converting an IPv4 or IPv6 address to a base 10 decimal/long/BigInt w/ netmask range calculation
import java.net.{Inet4Address, Inet6Address, InetAddress}
import scala.util.Try
sealed trait IPAddressException {
self: Throwable => val message: String
}
case class IPAddressParseException(message: String) extends Exception(message) with IPAddressException
trait IPAddress {
@someguy9
someguy9 / wp-remove-gutenberg-block-library-css.php
Last active November 21, 2023 08:00
Removed the "/wp-includes/css/dist/block-library/style.min.css" file from your WordPress site
<?php
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );
package app
import shapeless.ops.hlist.{ConstMapper, Mapper, ZipWith}
import shapeless.{::, HList, HNil, Poly2}
case class Params()
sealed trait EvaluatableGeneratorFilter[+Result] {
def eval(p: Params): Result
}
import cats.{ ApplicativeError, MonadError }
import cats.data.{ Kleisli, OptionT }
import cats.effect.Sync
import cats.effect.concurrent.Ref
import cats.syntax.all._
import io.circe.generic.auto._
import io.circe.syntax._
import org.http4s._
import org.http4s.circe.CirceEntityDecoder._
import org.http4s.circe._
@zparnold
zparnold / ena_setup_on_ec2.sh
Created March 8, 2018 18:40
Run this script on Ubuntu to enable ENA support.
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
#you may get an error E: Failed to fetch https://sdkrepo.atlassian.com/debian/dists/stable/contrib/binary-amd64/Packages 404 Not Found
#don't worry, you can continue without harm
sudo apt-get install -y build-essential dkms
git clone https://github.com/amzn/amzn-drivers
sudo mv amzn-drivers /usr/src/amzn-drivers-1.5.1
sudo touch /usr/src/amzn-drivers-1.5.1/dkms.conf
echo 'PACKAGE_NAME="ena"
PACKAGE_VERSION="1.5.1"
@allixender
allixender / geotools-jai-build.sbt
Last active July 19, 2019 09:50
To get GeoTools dependencies for Scala/SBT with JAI right on public build servers like Travis
// val geotoolsVersion = "8.7"
val geotoolsVersion = "9.5"
// val geotoolsVersion = "10.8"
// val geotoolsVersion = "11.3"
// val geotoolsVersion = "12.0"
// val geotoolsVersion = "13-SNAPSHOT"
libraryDependencies ++= Seq(
"org.geotools" % "gt-epsg-hsql" % geotoolsVersion,
"org.geotools" % "gt-referencing" % geotoolsVersion,
@rob-murray
rob-murray / siege_examples.sh
Last active April 1, 2024 03:48
Siege examples
# Basic example
siege -t60s -c20 -d10 'http://robertomurray.co.uk/'
# Basic auth;
auth=$(echo -n 'username:password' | openssl base64)
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/'