Skip to content

Instantly share code, notes, and snippets.

View namuan's full-sized avatar
🎯
Focusing

namuan namuan

🎯
Focusing
View GitHub Profile
@namuan
namuan / m3split
Last active July 12, 2020 13:11
Split mp3 file into smaller chunks
mp3splt -q -t 10.0 -o "@n @f" The\ first\ 20\ hours\ --\ how\ to\ learn\ anything\ \|\ Josh\ Kaufman\ \|\ TEDxCSU_5MgBikgcWnY.mp3
@namuan
namuan / floating_button_widget.py
Created January 2, 2020 10:25
PyQt5 Floating button on top of QPlainTextEdit
import sys
from PyQt5 import QtCore
from PyQt5 import QtWidgets
class FloatingButtonWidget(QtWidgets.QPushButton):
def __init__(self, parent):
super().__init__(parent)
@namuan
namuan / extract_httpstatus_enums.sh
Created November 14, 2019 21:17
Python one liner to extract and transform Spring HttpStatus enums
curl -s https://raw.githubusercontent.com/spring-projects/spring-framework/master/spring-web/src/main/java/org/springframework/http/HttpStatus.java | \
grep '\".*),' | \
while read line; \
do echo $line | python -c 'import re,sys; s, c, m = re.search("([\w\_]+)\((\d+),\s+\"([\w\s]+)", sys.stdin.readline()).groups(); print("{}: (\"HttpStatus.{}\", \"{}\"),".format(c, s, m))'; \
done
@namuan
namuan / redo_git_tag.sh
Created February 12, 2019 17:01
Re-do Git tag (Delete and re-add)
# List tags
git tag -l
# Delete existing tag
git tag -d <tag-name>
# Delete tag from remote
git push origin :refs/tags/<tag-name>
# New tag at HEAD
@namuan
namuan / presign_url.py
Created January 3, 2019 09:25 — forked from heitorlessa/presign_url.py
Quick and dirty S3 Presign URL using Python Boto3 and Click
import boto3
import click
@click.command()
@click.argument("bucket")
@click.argument("key")
@click.option("-e", "--expiration", default=3600, type=int, help="How long this presigned URL will live for")
def presign_s3(bucket, key, expiration):
""" Simple utility to generate presigned URL on S3 (Default 1 hour expiration)
@namuan
namuan / questions.js
Created January 1, 2019 12:18
NodeJS script to ask questions - Copied from https://github.com/revmischa/serverless-flask
// Check to see if the user has Docker installed
'use strict';
var inquirer = require('inquirer');
var chalk = require('chalk');
var YAML = require('js-yaml');
var fs = require('fs');
console.log(chalk.yellow('Hi, a few quick questions before we start:'));
@namuan
namuan / demo.css
Created December 17, 2018 17:52
css swagger
*{margin: 0;padding: 0;list-style: none;}
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote,
dl, dt, dd, ul, ol, li,
pre,
form, fieldset, legend, button, input, textarea,
th, td {
margin: 0;
padding: 0;
}
@namuan
namuan / local_dynamo.md
Created October 21, 2018 20:12
Running DynamoDB Locally
$ docker run -p 8000:8000 amazon/dynamodb-local

List dynamo tables

$ aws dynamodb list-tables --endpoint-url http://docker-ip:8000
@namuan
namuan / setup_webdav.md
Last active November 11, 2024 18:20
Setting up WebDAV server on Mac

Make sure that Mac Firewall allows incoming connection

cd <dir>
# Start WebDAV server
sudo wfsctl start
# Check status
sudo wfsctl start
# Share current directory
sudo wfsctl share $PWD
@namuan
namuan / running_jenkins_commands.sh
Created September 4, 2018 09:22
[Running CLI commands from Jenkins Script console] #jenkins #cli
# Simple command
"cat ...".execute().text
# Parse output
def dockerImages = "docker images".execute().text
dockerImages.eachLine { d -> !d.contains('feature') && println(d) }