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
@khalidx
khalidx / node-typescript-esm.md
Last active April 22, 2024 15:40
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@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
@hkoba
hkoba / sched-reboot.service
Last active November 6, 2023 16:07
systemd service and timer for scheduled reboot.
[Unit]
Description=Scheduled Reboot
[Service]
Type=simple
ExecStart=/usr/bin/systemctl --force reboot
@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">
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@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" *
#!/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
@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):
@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
##