Skip to content

Instantly share code, notes, and snippets.

View thepiwo's full-sized avatar
🐳
hacking sophia

Philipp Piwo thepiwo

🐳
hacking sophia
View GitHub Profile
@andreparames
andreparames / bitbit.py
Last active April 9, 2016 23:18
Store strings on the very useful https://booleans.io/
import requests
def frombits(s):
bts = (int(s[i:i+8], 2) for i in range(0, len(s), 8))
return str(bytearray(bts))
def tobits(s):
return ''.join(bin(b)[2:].zfill(8) for b in bytearray(s))
def storebit(bit):
@agemooij
agemooij / SnakifiedSprayJsonSupport.scala
Last active November 18, 2020 14:34
An example of how to customize the field mapping in spray-json to do generic transformation, in this case translating between camelcased Scala attributes and snakecase JSON attributes
/**
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 Andrew Snare, Age Mooij
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@lummie
lummie / gist:732b8cb0b478966b91a7f9244c7aeac7
Last active December 12, 2021 20:20
Change exif timezone with exiftool -8 hour
// I'm forever forgetting to adjust the time zone on my camera when taking pictures on vacation
// this uses the linux exiftool to adjust the timezone -8 hours for all images in a directory
exiftool "-DateTimeOriginal-=0:0:0 8:0:0" *
@w0rldart
w0rldart / install-mongodb.sh
Last active April 3, 2022 00:53
Installing MongoDB on Ubuntu 15.04
#!/bin/sh
##
## Bash install script for mongo 3.2 for Ubuntu 15.04, because of
## the replacement of upstart with systemd
##
## - AUTHOR: Alexandru Budurovici <https://w0rldart.com>
## - VERSION: 1.0
##
@Daenyth
Daenyth / SlickUpsert.scala
Created February 26, 2018 20:59
A slick profile extension to allow native postgres batch upsert
import com.github.tminglei.slickpg.ExPostgresProfile
import slick.SlickException
import slick.ast.ColumnOption.PrimaryKey
import slick.ast.{ColumnOption, FieldSymbol, Insert, Node, Select}
import slick.compiler.{InsertCompiler, Phase, QueryCompiler}
import slick.dbio.{Effect, NoStream}
import slick.jdbc.InsertBuilderResult
import slick.lifted.Query
// format: off
@fernandomantoan
fernandomantoan / schema.sql
Created September 23, 2014 18:05
Schema for PostgreSQL to use with JdbcTokenStore (Spring Security OAuth2)
create table oauth_client_details (
client_id VARCHAR(256) PRIMARY KEY,
resource_ids VARCHAR(256),
client_secret VARCHAR(256),
scope VARCHAR(256),
authorized_grant_types VARCHAR(256),
web_server_redirect_uri VARCHAR(256),
authorities VARCHAR(256),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@himalay
himalay / color-emoji-on-linux.sh
Created February 26, 2017 06:31
Color emoji on Arch Linux.
# create folders if does not exist
mkdir -p ~/.fonts
mkdir -p ~/.config/fontconfig/
# download noto color emoji font from https://www.google.com/get/noto/#emoji-zsye-color
# extract NotoColorEmoji.ttf file into ~/.fonts/
# create font config file
cat << 'EOF' > ~/.config/fontconfig/fonts.conf
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
@celoyd
celoyd / hi8-anim-howto.md
Last active August 1, 2022 15:37
A way to make Himawari-8 animations

Himawari-8 animation tutorial

Here’s how to make animations like this one. It requires intermediate Unix command-line knowledge, to install some tools and to debug if they don’t work. You’ll need these utilities:

  • curl (or you can translate to wget)
  • convert and montage, part of ImageMagick
  • ffmpeg, plus whatever codecs
  • parallel, for iteration that’s nicer than shell for loops or xargs
  • run everything in zsh for leading 0s in numerical ranges to work
#!/bin/bash
set -e
JAVA_HOME=${1-text}
[ $# -eq 0 ] && { echo "Usage: sudo $0 \$(/usr/libexec/java_home -v '1.8*')" ; exit 1; }
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
wget https://letsencrypt.org/certs/letsencryptauthorityx1.der
wget https://letsencrypt.org/certs/letsencryptauthorityx2.der