Skip to content

Instantly share code, notes, and snippets.

View rocel's full-sized avatar
🥳

Damien Chaillou rocel

🥳
  • WHM
  • Niteroi, Brazil / Nantes, France
  • X @dragda
View GitHub Profile
Act as an expert Prompt Engineer. Your primary reference for this task is the provided book: 'Prompt Engineering' by Lee Boonstra.
When I give you a prompt that I want to improve, which we'll call [User_Prompt_To_Improve], your objective is to analyze it and then transform it into an optimized version. This optimized version should be designed to take the biggest advantage of Gemini, based strictly on the principles, techniques, and best practices detailed in this book.
Your response should provide two key components:
The Optimized Prompt: Present the rewritten, improved version of [User_Prompt_To_Improve].
@rocel
rocel / program.py
Created September 4, 2023 02:29 — forked from Yatoom/program.py
Minion translator
from words import words
minionese_to_english = {v: k for k, v in words.items()}
def translate(sentence, minionese=False):
dictionary = words if not minionese else minionese_to_english
result = ""
for word in sentence.split(" "):
if word in dictionary.keys():
@rocel
rocel / requery.py
Created August 2, 2019 12:58 — forked from lloydw/requery.py
Simple query object for combining multiple redash queries
#
# Simple query object for combining multiple redash queries
#
# Example usage:
# Find all users who have logged in in the last 8 weeks who have sent an email by analysing the logstash logs
# Then group the results by the week they signed up on and their emailed yes/no status
#
# import requery
# userQuery = 'SELECT * FROM user WHERE lastSeen > DATE_SUB(NOW(), INTERVAL 8 WEEK)'
# emailQuery = '{ "index" : "logstash-*", "query": { "query_string": { "query": "action:sendEmail" } }, "size" : 1000 }
@rocel
rocel / SlackService.scala
Created January 4, 2019 18:05 — forked from ignasi35/SlackService.scala
A PoC client for Slack's "Custom Integrations" implemented as a Lagom Service.
package com.example.hello.api
import akka.NotUsed
import com.example.hello.api.SlackCustomIntegration.Message
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
import com.lightbend.lagom.scaladsl.api.Service._
import com.lightbend.lagom.scaladsl.api.transport.Method
import play.api.libs.json._
import play.api.libs.functional.syntax._
@rocel
rocel / Aircrack Commands
Created August 8, 2018 03:22 — forked from victorreyesh/Aircrack Commands
Cracking WPA2 / WEP Wifi / Aircrack 10 seconds guide. For Mac OSX
//Install Macports.
//Install aircrack-ng:
sudo port install aircrack-ng
//Install the latest Xcode, with the Command Line Tools.
//Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
//Figure out which channel you need to sniff:
sudo airport -s
sudo airport en1 sniff [CHANNEL]
@rocel
rocel / kakfa-oneway.java
Created July 12, 2018 19:56 — forked from codefromthecrypt/kakfa-oneway.java
Kafka one-way with Brave
/**
* This is an example of a one-way or "messaging span", which is possible by use of the {@link
* Span#flush()} operator.
*
* <p>Note that this uses a span as a kafka key, not because it is recommended, rather as it is
* convenient for demonstration, since kafka doesn't have message properties.
*
* <p>See https://github.com/openzipkin/zipkin/issues/1243
*/
public class KafkaExampleIT {
@rocel
rocel / flatten.java
Created May 23, 2018 23:32 — forked from ebuildy/flatten.java
Flatten Spark data frame fields structure, via SQL in Java
class Toto
{
public void Main()
{
final DataFrame source = GetDataFrame();
final String querySelectSQL = flattenSchema(source.schema(), null);
source.registerTempTable("source");
final DataFrame flattenData = sqlContext.sql("SELECT " + querySelectSQL + " FROM source")
@rocel
rocel / BackgroundService.java
Created May 13, 2017 18:15 — forked from gfreivasc/BackgroundService.java
A BackgroundService class for Android
package com.gabrielfv.android.engine;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
@rocel
rocel / headless.md
Created April 12, 2017 20:14 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

You can use chrome --headless on Linux as of M57 but note you'll need to build the binaries yourself for now.

The metabug for adding headless mode to Chromium is over here.

angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{