Skip to content

Instantly share code, notes, and snippets.

View diewland's full-sized avatar
✳️

diewland.eth diewland

✳️
View GitHub Profile
@diewland
diewland / dialogflow.txt
Created May 21, 2018 10:12
Dialogflow Yes-No template
okay
of course
i don't mind
do it
ok
sounds good
confirm
that's correct
I agree
yes
@diewland
diewland / rotate_log.sh
Created June 18, 2018 05:43
Rotate log batch script
ps aux | grep 'app.py' | grep -v grep | awk '{print "kill -9 " $2}' | sh
mv app.log app.log.$(date -d "today" +"%Y%m%d%H%M%S")
source ../venv/bin/activate
python app.py &> app.log &
@diewland
diewland / pyunzip.py
Last active July 4, 2018 03:38
Unzip with python
#!/usr/bin/env python3
import sys
from zipfile import PyZipFile
for zip_file in sys.argv[1:]:
pzf = PyZipFile(zip_file)
pzf.extractall()
@diewland
diewland / gb.bat
Created July 11, 2018 11:48
show git branch in windows command prompt
@echo off
set GITBRANCH=
for /f "tokens=2" %%I in ('git.exe branch 2^> NUL ^| findstr /b "* "') do set GITBRANCH=%%I
if "%GITBRANCH%" == "" (
prompt $P$G
) else (
prompt $P $C$E[10;7;32;47m%GITBRANCH%$E[0m$F $G
)
@diewland
diewland / Vagrantfile
Last active July 31, 2018 10:44
my Vagrantfile
Vagrant.configure("2") do |config|
...
# proxies
# vagrant plugin install vagrant-proxyconf
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://your.proxy.host:8080/"
config.proxy.https = "http://your.proxy.host:8080/"
config.proxy.no_proxy = "localhost,127.0.0.1"
@diewland
diewland / wav2flac.py
Last active February 5, 2023 10:37
convert wav to flac from python
from os.path import splitext
from pydub import AudioSegment
def wav2flac(wav_path):
flac_path = "%s.flac" % splitext(wav_path)[0]
song = AudioSegment.from_wav(wav_path)
song.export(flac_path, format = "flac")
if __name__ == "__main__":
import sys
@diewland
diewland / check_dup_filesize.py
Last active August 7, 2018 04:09
Check duplicate file size
import os
import sys
from pprint import pprint as pp
path = sys.argv[1]
size_dict = {}
for _, _, files in os.walk(path):
for f in files:
size = os.path.getsize("%s/%s" % (path, f))
@diewland
diewland / split_mp3_to_flac_files.py
Last active August 14, 2018 08:38
Split stereo mp3 to mono flac files
import os, sys
from pydub import AudioSegment
filepath = sys.argv[1]
filename, ext = os.path.splitext(filepath)
flacname = "%s.flac" % filename
song = AudioSegment.from_mp3(filepath)
song = song.set_frame_rate(16000)
song = song.set_channels(1)
@diewland
diewland / MainActivity.java
Created August 30, 2018 02:56
Eddystone URL Demo
/*
https://github.com/adriancretu/beacons-android
*/
package com.diewland.fake_beacons;
import android.app.Activity;
import android.os.Bundle;
import com.uriio.beacons.Beacons;
import com.uriio.beacons.model.EddystoneURL;
public class MainActivity extends Activity {
@diewland
diewland / default
Last active April 29, 2020 18:12 — forked from ColeMurray/default
my nginx config example
server {
listen 80;
server_name YOUR_SERVERS_IP_ADDRESS;
location ~ ^/(js/|img/|css/) {
root /path/to/public/static/;
access_log off;
expires 24h;
}
location / {