Skip to content

Instantly share code, notes, and snippets.

View dspinellis's full-sized avatar

Diomidis Spinellis dspinellis

View GitHub Profile
@cventour
cventour / covid19gr-stats.sh
Last active February 23, 2022 12:43
Extract covid19.gov.gr infections stats (whole history)
#!/bin/sh
curl https://covid19.innews.gr | gunzip > covid.html
cat covid.html | grep daily_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > daily_stats.json
cat covid.html | grep weekly_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > weekly_stats.json
cat covid.html | grep three_days_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > three_days_stats.json
cat covid.html | grep last_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > today_stats.json
cat covid.html | grep total_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > total_stats.json
rm covid.html
@chrisma
chrisma / bibtex_from_doi.sh
Last active April 20, 2020 15:29
Get BibTeX entry from doi.org
wget -qO- --header="Accept: application/x-bibtex" "https://doi.org/10.1109/5.771073"
@mjyc
mjyc / gise.sh
Last active April 4, 2020 20:52
Search & edit git-issue in terminal
vim $(grep -lR "$(sk --ansi -i -c 'grep -lER "{}" .issues/issues/ | grep -v tags | grep -v comments | xargs head -q -n 1')" .issues/issues/)
@wouterds
wouterds / useAppState.ts
Created February 22, 2020 17:09
React Native useAppState hook
import { useState, useEffect, useCallback } from 'react';
import { AppState, AppStateStatus } from 'react-native';
const useAppState = () => {
const [appState, setAppState] = useState(AppState.currentState);
const handleAppStateChange = useCallback(
(nextAppState: AppStateStatus) => {
setAppState(nextAppState);
},
[setAppState],
@johnjreiser
johnjreiser / AmazonLinux-InstallPostGIS.sh
Last active April 29, 2024 14:55
Script to install PostgreSQL 13 and PostGIS 3.2 on fresh Amazon Linux 2
#!/bin/bash
# Script to install PostgreSQL and PostGIS on a fresh Amazon Linux instance
# Installing from source:
# - GEOS
# GEOS 3.10+ requires CMake 3+, not readily available on Amazon Linux 2.
GEOSVER=3.9.2
GEOSURL=http://download.osgeo.org/geos/geos-${GEOSVER}.tar.bz2
# - PROJ (GDAL requires 6+; 6.2.1 is the last to use SQLite 3.7; 6.2 had build issues, so 6.1.1)
/**
* Building Maintainable Software - Ten Guidelines for Future Proof Code
* https://www.amazon.com/Building-Maintainable-Software-Java-Future-Proof/dp/1491953527
*
* Write Simple Units of Code - Dealing with Nesting, page 36.
*
* I like the example on page 36 because it's simple and just enough to demonstrate how hard is
* to write straightforward code, or how easy is to increase the Accidental Complexity of the code.
*
* There are 4 implementations of the same functionality. The first one is the original code,
@iodic
iodic / exclude-directory-from-git-diff.sh
Created March 28, 2018 09:41
Exclude a directory from git diff
git diff -- . ':!directory_name'
@gousiosg
gousiosg / unix-compatible.sh
Last active November 20, 2017 10:17
How compatible is your Unix with the original one?
#!/usr/bin/env bash
TEMPFILE=/tmp/unixcount
exist=0
notexist=0
echo 0 0 > $TEMPFILE
curl "https://raw.githubusercontent.com/dspinellis/unix-v4man/master/man0/ptxx"|
grep "(I)"|
@MightyPork
MightyPork / usb_hid_keys.h
Last active July 5, 2024 22:07
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@dennmtr
dennmtr / athens-radio.m3u
Last active July 2, 2024 08:08
Athens Radio Playlist
#EXTM3U
#EXTINF:0,087.50 ~ Κρήτη FM - 087.50 ~ Κρήτη FM
http://s3.onweb.gr:8878
#EXTINF:0,087.70 ~ En Lefko - 087.70 ~ En Lefko
https://stream.radiojar.com/enlefko877
#EXTINF:0,088.00 ~ Μέντα - 088.00 ~ Μέντα
https://stream.radiojar.com/menta.aac
#EXTINF:0,088.60 ~ Kids Radio - 088.60 ~ Kids Radio
https://stream.radiojar.com/64p6ktzntg0uv
#EXTINF:0,088.90 ~ Hit - 088.90 ~ Hit