Skip to content

Instantly share code, notes, and snippets.

View lpellegr's full-sized avatar
Enjoying life every second of the day

Laurent Pellegrino lpellegr

Enjoying life every second of the day
View GitHub Profile
User-Agent Email Client
"AHC/2.1" Unknown
"Apache-HttpClient/4.5.1 (Java/1.8.0_172)" Unknown
"Apache-HttpClient/UNAVAILABLE (Java/17.0.11)" Unknown
"Apache-HttpClient/UNAVAILABLE (Java/1.8.0_362)" Unknown
"axios/0.19.2" Unknown
"curl/8.1.0" Unknown
"curl/8.4.0" Unknown
"Dalvik/2.1.0 (Linux; U; Android 10; NOH-NX9 Build/HUAWEINOH-N29)" Unknown
"Dalvik/2.1.0 (Linux; U; Android 12; 2107119DC Build/SKQ1.211006.001)" Unknown
@lpellegr
lpellegr / microsoft-azure-datacenters.json
Last active May 30, 2024 07:30
Microsoft Azure Datacenters (including coordinates)
[
{
"displayName": "East US",
"id": "/subscriptions/41160c59-742a-4bb6-9a57-32c3cf05a343/locations/eastus",
"metadata": {
"geographyGroup": "US",
"latitude": "37.3719",
"longitude": "-79.8164",
"pairedRegion": [
{
@lpellegr
lpellegr / ScalewayStorageService.java
Last active June 25, 2021 00:38
Scaleway Object Storage in Java using Amazon S3 SDK
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import java.io.InputStream;
import java.net.URI;
import java.util.function.Consumer;
@lpellegr
lpellegr / IpregistryTest.java
Last active May 28, 2020 15:32
Consecutive private local IP lookup using Ipregistry API and apache HTTP client
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class IpregistryTest {
public static void main(String[] args) throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
@lpellegr
lpellegr / DnsJavaTryOut.java
Created January 14, 2020 19:12
DnsJava Issue #8
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;
public class DnsJavaTryOut {
public static void main(String[] args) throws TextParseException {
Record[] records = new Lookup("4.4.8.8.in-addr.arpa", Type.PTR).run();
for (Record record : records) {
@lpellegr
lpellegr / ipregistry-php-batch.php
Last active January 13, 2020 10:10
Retrieve IP Info in PHP for a list of IP addresses using ipregistry.co
<?php
$curl = curl_init();
$payload = json_encode(array("66.165.2.7", "1.1.1.1", "8.8.4.4"));
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.ipregistry.co/?key=tryout",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class LanguageTags {
public static void main(String[] args) {
Locale[] locales = Locale.getAvailableLocales();
List<LocaleEntry> entries = new ArrayList<>(locales.length);
@lpellegr
lpellegr / TimeZoneList.java
Last active November 2, 2019 12:19
TimeZone List Generator from Java
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
public class TimeZoneList {
public static void main(String[] args) {
String[] zoneIds = TimeZone.getAvailableIDs();
webpackJsonp([3],{"+Jt5":function(t,e,i){"use strict";function s(){this.defaultAttrs({pendingFollowersTitleSelector:".ProfileHeading-pendingFollowersText"}),this.handlePendingFollowerChange=function(t,e){e.pendingRequestsHtml&&this.select("pendingFollowersTitleSelector").html(e.pendingRequestsHtml)},this.after("initialize",function(){this.on(document,"dataFollowerAcceptSuccess",this.handlePendingFollowerChange),this.on(document,"dataFollowerDeclineSuccess",this.handlePendingFollowerChange)})}var o=i("DBjh");e.a=Object(o.default)(s)},"/gHE":function(t,e,i){"use strict";function s(t,e,i,s,p){var g=m({},t,{endpoint:e,itemType:s,eventData:{scribeContext:{component:p||s}}});Object(o.a)(m({},g,{statsName:i})),Object(a.a)("#timeline",g);var v="home"===g.pageName||"me"===g.pageName||"profile"===g.pageName,b=v?[h.a]:[];u.a.mixin.apply(this,b).attachTo("#timeline",g);var S=[];v&&(S=S.concat(l.a),f.a.attachTo("#timeline",g)),r.a.attachTo(document),n.a.mixin.apply(this,S).attachTo("#timeline",g),d.a.attachTo("#timeline",
@lpellegr
lpellegr / Dockerfile
Created September 14, 2018 22:02 — forked from tnolet/Dockerfile
A Dockerfile for running Puppeteer. Used for https://trypuppeteer.com. Scraped together from various sources. Works well with Puppeteer 1.0.0
FROM ubuntu:16.04
# Create a user so our program doesn't run as root.
RUN mkdir -p /home/chrome/
RUN groupadd -r chrome &&\
useradd -r -g chrome -d /home/chrome -s /sbin/nologin -G audio,video chrome
ENV HOME=/home/chrome