Skip to content

Instantly share code, notes, and snippets.

View mvz's full-sized avatar

Matijs van Zuijlen mvz

View GitHub Profile
@rain-1
rain-1 / GPT-4 Reverse Turing Test.md
Last active April 16, 2024 23:19
GPT-4 Reverse Turing Test

The reverse turing test

I asked GPT-4 to come up with 10 questions to determine if the answerer was AI or human.

I provided my own answers for these questions and I also asked ChatGPT to answer them.

The result is that GPT-4 was able to correctly differentiate between AI and Human.

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@brenogazzola
brenogazzola / migrate_im_to_vips.md
Last active March 17, 2024 21:56
Steps to migrate ImageMagick to Libvips

For apps built before the image_processing gem became the default, the migration will involve two steps:

  1. Migrating to the image processing syntax while still using ImageMagick;
  2. Switching to Vips and updating the compression options;

Migrate to the image processing syntax

Before changing from ImageMagick to Vips, it's better to first test the new syntax and ensure everything is still working.

1. Move everything that has to do with compression to a saver hash:

variant(format: :jpg, strip: true, quality: 80)
@pepijndevos
pepijndevos / core.clj
Created September 16, 2011 11:17
Micro Wiki
(ns wiki.core
(:use net.cgrand.moustache
ring.adapter.jetty
ring.util.response
[ring.middleware params stacktrace reload]
hiccup.core
com.ashafa.clutch)
(:require [clojure.string :as s])
(:import org.pegdown.PegDownProcessor))
@ssoroka
ssoroka / acceptance_helper.rb
Created May 30, 2011 05:45
Use feature, background, and scenario blocks to write acceptance tests in test/unit
# Use feature, background, and scenario blocks to write acceptance tests in test/unit
# which are really just integration tests. include capybara or webrat or something and voila.
# test/acceptance_helper.rb
require 'test_helper'
module ActionDispatch
class AcceptanceTest < ActionDispatch::IntegrationTest
class << self
alias :background :setup
@jhannes
jhannes / investigate.rb
Created May 13, 2011 11:06
Refactoring in the 4th dimension
require 'rubygems'
require 'awesome_print'
load 'repodepot.rb'
class CodeEvent
def full_method_name
class_name + "#" + method_name
end
@michaelfeathers
michaelfeathers / methodshark.rb
Created March 9, 2011 15:58
Output the complexity trend of an individual method across its history
#!/usr/bin/env ruby
# Print the complexity over time for a Ruby method in a
# git repository.
#
# Requires: >= bash ?.?
# >= git 1.7.1
# >= ruby 1.9.2
# >= flog 2.5.0
#
@ahoward
ahoward / net-http-debug.rb
Created December 10, 2010 20:06
a simple way to debug tons of libs that use ruby's net/http
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
require 'sinatra'
require 'omniauth'
class Application < Sinatra::Base
use OmniAuth::Builder do
provider :github, 'github_id', 'github_secret'
end
get '/' do
@augustl
augustl / application_helper.rb
Created October 29, 2008 14:24
The simplest thing that could possibly work.
def path_to_attachment_image(attachment)
image_path("attachments/#{attachment.filename}")
end