Skip to content

Instantly share code, notes, and snippets.

View baltpeter's full-sized avatar

Benjamin Altpeter baltpeter

View GitHub Profile
@baltpeter
baltpeter / script.sh
Created March 22, 2014 23:09
System Update with apt/aptitude
apt-get update # update repositories first
# then do either
apt-get dist-upgrade
aptitude safe-upgrade # about equiv. to above, safer though
# alternative, doesn't install or uninstall any packages
apt-get upgrade
# reference: http://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade
@baltpeter
baltpeter / script.sh
Created March 22, 2014 23:02
Find out system architecture on Unix
uname -m
@baltpeter
baltpeter / script.sh
Last active July 5, 2016 11:00
Setting up locale correctly on new Ubuntu/Debian servers
apt-get update # if this is the first boot on e.g. OpenVZ containers
apt-get install language-pack-en
update-locale LANG=en_US.UTF-8
shutdown -rf 0 # reboot to ensure new locale is applied
# when lang is "(undefinded)"; also preferred anyway
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
@baltpeter
baltpeter / script-bash.sh
Created January 21, 2017 19:04
Create 100 files with random hex-like filenames and random binary content
for n in {1..100}; do
dd if=/dev/urandom of=$( cat /dev/urandom | tr -cd 'a-f0-9' | head -c 6 ) bs=1 count=$(( RANDOM + 1024 ))
done
@baltpeter
baltpeter / domainchecker.php
Last active May 16, 2018 19:41
Reads a list of words and outputs those that are available as both .de and .com to the console
<?php
header('Content-type: text/plain');
function checkdomain($domain) {
if($domain == '.com' OR $domain == '.de') return false;
$api_req = file_get_contents('http://freedomainapi.com/?key=YOURAPIKEY&domain=' . $domain);
$api_req = json_decode($api_req, true);
return $api_req['available'] == 'true';
}
@baltpeter
baltpeter / keybindings.json
Created March 3, 2020 21:25
VS Code keyboard shortcuts
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "ctrl+up",
"command": "-scrollLineUp",
@baltpeter
baltpeter / index.mjs
Created June 16, 2022 19:29
Play Store batchexecute request for top charts
import fetch from 'cross-fetch';
(async () => {
// This request is exactly replicated from what the Play Store website does.
const res = await fetch(
'https://play.google.com/_/PlayStoreUi/data/batchexecute?rpcids=vyAe2&source-path=%2Fstore%2Fapps&f.sid=-7855711026347449501&bl=boq_playuiserver_20220612.08_p0&hl=en&authuser&soc-app=121&soc-platform=1&soc-device=1&_reqid=74074&rt=c',
{
credentials: 'include',
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0',
@baltpeter
baltpeter / index.mjs
Last active June 16, 2022 20:05
Play Store batchexecute request for top charts, cleaned up (step 1)
import fetch from 'cross-fetch';
(async () => {
const res = await fetch('https://play.google.com/_/PlayStoreUi/data/batchexecute', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
},
body: `f.req=${JSON.stringify([
[
[
@baltpeter
baltpeter / res.json
Created June 16, 2022 20:29
Play Store batchexecute response for top charts, formatted
This file has been truncated, but you can view the full file.
[
[
"wrb.fr",
"vyAe2",
[
[
null,
[
[
@baltpeter
baltpeter / index.mjs
Created June 16, 2022 21:04
Play Store batchexecute request for top charts, cleaned up (step 2)
import fetch from 'cross-fetch';
(async () => {
const language = 'en';
const country = 'de';
const length = 2;
const chart_name = 'topselling_free';
const category_id = 'APPLICATION';
const res = await fetch(`https://play.google.com/_/PlayStoreUi/data/batchexecute?hl=${language}&gl=${country}`, {