Skip to content

Instantly share code, notes, and snippets.

View gregorym's full-sized avatar
🏠
Working from home

Gregory Marcilhacy gregorym

🏠
Working from home
View GitHub Profile
@gregorym
gregorym / doesnotwork.rb
Created July 18, 2011 18:47
Basecamp Api not working
Basecamp::Message.prefix = "/projects/:project_id/"
# Basecamp::Base.establish_connection!( my info the connecy)
m = Basecamp::Message.new(:project_id => 7584268)
m.title = "greg"
m.body = "plop"
m.author_id = 7714821
m.private = false
m.notify = ["7714823"]
print m.encode
m.save
@gregorym
gregorym / calculator.rb
Created October 26, 2011 20:52
Top numbers at the Euro millions
history = %(06 14 33 34 48
09 19 25 36 38
02 08 17 39 42
09 28 30 32 49
05 21 28 31 34
35 42 47 48 50
12 26 37 38 44
02 08 10 19 46
12 22 25 33 45
04 06 14 42 50
@gregorym
gregorym / .bash_profile
Created October 28, 2011 21:24
An important line on my bash_profile
export PS1='\[[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[0m\]]\[\033[01;33m\]$(__git_ps1)\[\033[0m\] $(~/.rvm/bin/rvm-prompt i g)\$ '
@gregorym
gregorym / user_spec.rb
Created November 16, 2011 22:09
Cakehealth
class User < ActiveRecord::Base
has_and_belongs_to_many :plans, :after_add => :add_enrollment
has_many :enrollments
def coenroll_with(couser)
couser.plans.each do |p|
plans << p
end
end
# Enter your code here. Read input from STDIN. Print output to STDOUT
N = gets.to_i
words = []
while words.length < N do
words << gets.sub(/\\n$/, '').strip
end
words.each do |word|
count = 0
@gregorym
gregorym / index.js
Created September 16, 2017 17:44
Lambda with Browser instance
const puppeteer = require('puppeteer');
exports.handler = function(event, context, callback) {
getBrowser().then((browser) => {
browser.newPage((page) => {
// Code
});
});
}

Keybase proof

I hereby claim:

  • I am gregorym on github.
  • I am gmarcilhacy (https://keybase.io/gmarcilhacy) on keybase.
  • I have a public key ASB7bX7bmzU6iLmI_Ole0NchD4I4n3PlvK9P-ZtkEKfx3wo

To claim this, I am signing this object:

@gregorym
gregorym / api.ts
Last active July 16, 2024 13:41
Next.js - Child process
import { NextApiResponse } from 'next';
import { fork } from "child_process";
import path from 'path';
import fs from 'fs';
async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
@gregorym
gregorym / gist:639173558fad7fe4916fb279b7822490
Created January 16, 2022 06:47
NRT Art Generator mint button SDK
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.6.1/web3.min.js" integrity="sha512-5erpERW8MxcHDF7Xea9eBQPiRtxbse70pFcaHJuOhdEBQeAxGQjUwgJbuBDWve+xP/u5IoJbKjyJk50qCnMD7A==" crossorigin="anonymous"></script>
<script type="module" src="https://cdn.nft-generator.art/js-sdk/v1.2.0/nft-art-generator-sdk/nft-art-generator-sdk.esm.js"></script>
<script nomodule src="https://cdn.nft-generator.art/js-sdk/v1.2.0/nft-art-generator-sdk/nft-art-generator-sdk.js"></script>
<meta name="nft-art-contract-abi" content="W3sidHlwZSI6ImNvbnN0cnVjdG9yIiwiaW5wdXRzIjpbeyJuYW1lIjoiX3VyaSIsInR5cGUiOiJzdHJpbmciLCJpbnRlcm5hbFR5cGUiOiJzdHJpbmcifSx7Im5hbWUiOiJfbmFtZSIsInR5cGUiOiJzdHJpbmciLCJpbnRlcm5hbFR5cGUiOiJzdHJpbmcifSx7Im5hbWUiOiJfc3ltYm9sIiwidHlwZSI6InN0cmluZyIsImludGVybmFsVHlwZSI6InN0cmluZyJ9LHsibmFtZSI6Il90b3RhbFN1cHBseSIsInR5cGUiOiJ1aW50MzIiLCJpbnRlcm5hbFR5cGUiOiJ1aW50MzIifSx7Im5hbWUiOiJfY29zdCIsInR5cGUiOiJ1aW50MjU2IiwiaW50ZXJuYWxUeXBlIjoidWludDI1NiJ9LHsibmFtZSI6Il9vcGVuIiwidHlwZSI6ImJvb2wiLCJpbnRlcm5hbFR5cGUiOiJib29sIn
import fetch from 'node-fetch';
const pinata_api_key = '';
const pinata_secret_api_key = '';
(async () => {
const data = await fetch(
'https://api.pinata.cloud/data/pinList?status=pinned&pageLimit=1000',
{
method: 'GET',