Skip to content

Instantly share code, notes, and snippets.

@Piskvor
Piskvor / extract_cookies.sh
Created November 9, 2022 14:27 — forked from hackerb9/extract_cookies.sh
Extract cookies.sqlite to cookies.txt for use in wget or curl.
#!/bin/bash -e
# extract_cookies.sh:
#
# Convert from Firefox's cookies.sqlite format to Netscape cookies,
# which can then be used by wget and curl. (Why don't wget and curl
# just use libsqlite if it's installed?)
# USAGE:
#
# $ extract_cookies.sh > /tmp/cookies.txt
@Piskvor
Piskvor / nearby-coordinates.sql
Created November 4, 2022 07:39 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@Piskvor
Piskvor / init.sh
Created October 24, 2022 14:16 — forked from m13253/init.sh
Minimal working initramfs for BusyBox, with login
#!/bin/busybox sh
# 1) Download a prebuilt BusyBox binary here:
# https://busybox.net/downloads/binaries/
#
# 2) Prepare your kernel
# cp /boot/vmlinuz vmlinuz
#
# 3) Copy the files
# install -Dm0755 busybox-x86_64 initramfs/bin/busybox
// [bbox:south,west,north,east]
[bbox:50.05,14.42,50.10,14.51]
[out:json];
area["name"="Žižkov"]["admin_level"="10"]->.administrativeBoundary;
(
nwr["highway"]["name"](area.administrativeBoundary);
);
out center;
out count;
@Piskvor
Piskvor / u2f.sh
Created August 13, 2021 14:16
Ubuntu 18.04 u2f
# find the new device
lsusb -t
> Port 3: Dev 20, If 1, Class=Chip/SmartCard
# device number from lsusb "Dev"
lsusb -s 20
> Bus 001 Device 020: ID 32a3:3201
@Piskvor
Piskvor / phpstan-check-on-save.md
Created September 27, 2019 12:38
Make PhpStorm check the current PHP file on save.

PhpStorm + PhpStan watcher

PhpStorm - Settings - Tools - File Watchers (create new)

  • File type: PHP
  • Scope: Project files
  • Program (wherever your phpstan is located, obvs.): $ContentRoot$/vendor/phpstan/phpstan/bin/phpstan
  • Arguments: analyse $FilePath$
  • Working directory (this is probably the directory with phpstan.neon): $ContentRoot$
  • Show console: on error
@Piskvor
Piskvor / blink_ip.pl
Created February 19, 2019 13:36 — forked from chrismeyersfsu/blink_ip.pl
Raspberry Pi Blink Ip Address
@Piskvor
Piskvor / RPi-install-wifi.sh
Created March 6, 2018 23:14 — forked from kmonsoor/RPi-install-wifi.sh
install wifi adapter drivers on Raspberry Pi; origin: http://www.fars-robotics.net/install-wifi
#!/bin/bash
#set -e
# origin-source: http://www.fars-robotics.net/install-wifi
# install-wifi - v9.4 - by MrEngman.
# After downloading this script:
# $ sudo mv ./install-wifi /usr/bin/install-wifi
# $ sudo chmod +x /usr/bin/install-wifi
# $ sudo install-wifi -h
#
@Piskvor
Piskvor / index.php
Last active September 12, 2018 10:27
Simple logger for requests
<?php
declare(strict_types=1);
/*
Usage:
start PHP devel server in this script's directory:
php -S [::]:8888
send requests to http://your-ip-address:8888/
JSON events are logged to event.log
@Piskvor
Piskvor / experiments_lines_drag.user.js
Last active December 30, 2016 09:34 — forked from spite/gist:90e3dbf8e117660f6788a5748ae06cad
Go to https://lines.chromeexperiments.com/drag/, start the experience and run this code in the console - or install it as a userscript.
// ==UserScript==
// @name Animate the Lines WebGL experiment automatically
// @namespace https://gist.github.com/spite/90e3dbf8e117660f6788a5748ae06cad
// @version 0.2
// @description Automatically drags the mouse, leading to a pleasant effect
// @author spite, userscripted by Piskvor
// @match https://lines.chromeexperiments.com/drag/
// @grant none
// @updateURL https://gist.github.com/Piskvor/41df1f68b44b43100552126c76e2f609/raw/experiments_lines_drag.user.js
// ==/UserScript==