Skip to content

Instantly share code, notes, and snippets.

@jdecaron
jdecaron / ip.js
Created September 15, 2022 20:09
Cloudflare Worker that returns the IP address
addEventListener('fetch', event => {
return event.respondWith(
new Response(event.request.headers.get('CF-Connecting-IP'))
)
})
@jdecaron
jdecaron / httprequestdump.js
Created August 15, 2019 18:28
Change public Gist that dumps HTTP request and print direct to console instead of writing into file
'use strict';
let fs = require('fs'),
http = require('http'),
HOSTNAME =process.env.HOSTNAME || '0.0.0.0',
PORT = process.env.PORT || 8080,
ACK_HTTP_CODE = 200,
ACK_CONTENT_TYPE = 'text/plain',
@jdecaron
jdecaron / clone-all-gitlab-group-projects.js
Last active July 22, 2019 19:27
Clone all projects from a Gitlab group using a NodeJS interpreter
const repos = require('./gitlab.json');
const { execSync } = require('child_process');
repos.reduce((previous, repo) => {
execSync('git clone ' + repo.ssh_url_to_repo);
}, undefined)
@jdecaron
jdecaron / clone-all-gitlab-group-projects.sh
Created July 22, 2019 19:25
Clone all projects from a Gitlab group using a NodeJS interpreter
# One liner to clone all your group projects
# with a NodeJS interpreter. You need to substitute
# two things in this one liner: group, token.
curl -s https://gitlab.com/api/v4/groups/group/projects?private_token=token&search=&per_page=999 > gitlab.json && node -e "const repos = require('./gitlab.json'); const { execSync } = require('child_process'); repos.reduce((previous, repo) => { execSync('git clone ' + repo.ssh_url_to_repo); }, undefined)"
'use strict';
/**
* RSA hash function reference implementation.
* Uses BigInteger.js https://github.com/peterolson/BigInteger.js
* Code originally based on https://github.com/kubrickology/Bitcoin-explained/blob/master/RSA.js
*
* @namespace
*/
var RSA = {};
@jdecaron
jdecaron / sync.js
Last active November 17, 2016 16:22
console.log("script inserted");
@jdecaron
jdecaron / prusa_i3_print_pet.ini
Created January 31, 2016 03:56
Prusa i3 printer settings for taulman 3D t-glase PET
# generated by Slic3r 1.3.0-dev on Sat Jan 30 21:21:01 2016
avoid_crossing_perimeters = 0
bottom_solid_layers = 3
bridge_acceleration = 750
bridge_flow_ratio = 1
bridge_speed = 40
brim_width = 0
complete_objects = 0
default_acceleration = 2000
dont_support_bridges = 1
#! /bin/bash
IFS=$'\n'
for a in `find -type f -size 1M -not -path '*.svn*'`; do
grep -inH "$1" $a
done
@jdecaron
jdecaron / flash.c
Last active December 19, 2015 10:39
#include <stdio.h>
#include <windows.h>
#include <winsock2.h>
int pid = 0;
STARTUPINFO lpStartupInfo;
PROCESS_INFORMATION lpProcessInformation;
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd, LPARAM lparam){
DWORD p;
@jdecaron
jdecaron / udp.c
Created November 21, 2012 08:11
udp.c
int incomingByte = 0;
int nov = 12;
int numberOfBytes = 0;
int rta = 13;
void getLastByte(){
for(int i = 0; i < numberOfBytes; i++){
incomingByte = Serial.read();
}
}