Skip to content

Instantly share code, notes, and snippets.

View Dinduks's full-sized avatar

Samy Dindane Dinduks

View GitHub Profile
@katowulf
katowulf / print_ip_and_headers.js
Last active January 12, 2022 05:51
Print IP address and headers in Cloud Functions
const functions = require('firebase-functions');
const util = require('util');
exports.helloWorld = functions.https.onRequest((req, res) => {
// For Firebase Hosting URIs, use req.headers['fastly-client-ip']
// For callable functions, use rawRequest
// Some users have better success with req.headers['x-appengine-user-ip']
const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const headers = JSON.stringify(req.headers, null, 2);
const message = util.format("<pre>Hello world!\n\nYour IP address: %s\n\nRequest headers: %s</pre>", ipAddress, headers);
@angelo-v
angelo-v / jwt-decode.sh
Last active July 12, 2024 09:51
Decode a JWT via command line
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904
function jwt-decode() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
jwt-decode $JWT
@kmikko
kmikko / 1_Arch_installation.md
Last active March 10, 2024 02:36
Arch Linux installation guide with LVM on LUKS

Arch Linux Installation Guide

Create bootable USB

Download Arch Linux iso file: https://www.archlinux.org/download/

Plug and identify your USB flash drive

lsblk

Unmount if necessary

@heppu
heppu / ARCH_INSTALL.MD
Last active February 27, 2022 17:01
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
@TKAB
TKAB / index.js
Last active July 10, 2019 21:37
Importing firebaseui
/*global firebaseui*/
/*global firebase*/
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import './index.css';
@mjnaderi
mjnaderi / install-arch.md
Last active July 15, 2024 21:07 — forked from mattiaslundberg/arch-linux-install
Installing Arch Linux with Full Disk Encryption (LVM on LUKS)

Installing Arch Linux with Full Disk Encryption

If you're aiming for a seamless Arch Linux installation in UEFI mode, follow along as this guide will walk you through the process step by step. We'll be using LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) partitions on LUKS to achieve full disk encryption.

Note: I have updated this doc for UEFI mode. For those with BIOS/MBR systems, you can refer to the previous version, but keep in mind that it might be outdated and no longer accurate.

If you're only interested in installing Linux and not setting up dual boot with Windows, feel free to skip the Windows-related sections.

@josteink
josteink / on_stateful_code.txt
Last active October 21, 2020 05:37
On why stateful code is bad
On why stateful code is bad
===========================
STUDENT: Sir, can I ask a question?
TEACHER: Yes!
STUDENT: How do you put an elephant inside a fridge?
TEACHER: I don't know.
STUDENT: It's easy, you just open the fridge and put it in. I have another question!
TEACHER: Ok, ask.
STUDENT: How to put a donkey inside the fridge?
@metalspatula
metalspatula / arch-install-uefi-gpt-lvm_on_luks.sh
Last active July 9, 2016 13:07 — forked from jeffsharpe/arch-install-uefi-gpt-lvm_on_luks.sh
Arch - UEFI GPT LVM on LUKS (single drive)
### ONGOING MODIFICATION/REPLACEMENT OF JEFF SHARPE'S INSTRUCTIONS
### Arch Linux Installation Notes
### UEFI GPT LVM on LUKS (single drive)
###
### These are my personal notes to install Arch. Its not a script, but step by step instructions. If using
### please be aware that every step should be considered before applying, to personalize your
### installations appropriately.
###
@t-model
t-model / SampleAQS.scala
Last active August 29, 2015 13:56
akka-quartz-scheduler
//app/batch/SampleAQS.scala
package batch
import play.api._
import play.api.Play.current
import play.api.libs.concurrent.Akka
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import akka.actor.{Actor, ActorSystem, Props}
import com.typesafe.akka.extension.quartz.QuartzSchedulerExtension
@mortezaadi
mortezaadi / persistence.xml
Last active March 13, 2023 10:54
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->