Skip to content

Instantly share code, notes, and snippets.

View fourdollars's full-sized avatar
🏠
Working from home

Shih-Yuan Lee (FourDollars) fourdollars

🏠
Working from home
View GitHub Profile
@fourdollars
fourdollars / gist:0596cbc2c55147fd5225bb9a8a0bdcda
Created August 29, 2022 02:17
docker compose logs worker
concourse-docker-worker-1 | {"timestamp":"2022-08-29T02:15:40.733583378Z","level":"info","source":"baggageclaim","message":"baggageclaim.using-driver","data":{"driver":"overlay"}}
concourse-docker-worker-1 | {"timestamp":"2022-08-29T02:15:40.743816679Z","level":"info","source":"worker","message":"worker.garden.dns-proxy.started","data":{"session":"1.2"}}
concourse-docker-worker-1 | {"timestamp":"2022-08-29T02:15:40.745154086Z","level":"info","source":"baggageclaim","message":"baggageclaim.listening","data":{"addr":"127.0.0.1:7788"}}
concourse-docker-worker-1 | {"timestamp":"2022-08-29T02:15:40.745435115Z","level":"error","source":"worker","message":"worker.beacon-runner.beacon.failed-to-connect-to-tsa","data":{"error":"dial tcp 172.18.0.3:2222: connect: connection refused","session":"4.1"}}
concourse-docker-worker-1 | {"timestamp":"2022-08-29T02:15:40.745463946Z","level":"error","source":"worker","message":"worker.beacon-runner.beacon.dial.failed-to-connect-to-any-tsa","data":{"error":"all worker SSH gat
@fourdollars
fourdollars / docker.json
Created August 24, 2022 08:45
sudo packer build docker.json
{
"variables": {
"ansible_host": "default",
"ansible_connection": "docker"
},
"builders": [
{
"type": "docker",
"image": "centos:7",
"commit": true,
$ pyenv install 3.10.6 -f
Installing Python-3.10.6...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python curses extension was not compiled. Missing the ncurses lib?
WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
WARNING: The Python tkinter extension was not compiled and GUI subsystem has been detected. Missing the Tk toolkit?
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
#!/usr/bin/env python
import time
from flask import Flask, render_template, Response
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@fourdollars
fourdollars / gist:af5c990874148915290046108afdc393
Created October 15, 2020 16:06
A Bash script to strip last N elements
#!/bin/bash
strip_last_n()
{
n="$1"
shift
if [ "$n" -ge "$#" ]; then
return
else
len="$(($# - n))"
@fourdollars
fourdollars / brightness.stap
Created January 29, 2019 09:28
Using SystemTap to check the brightness level changes.
#!/usr/bin/env stap
probe module("video").function("acpi_video_device_lcd_set_level").call
{
printf ("%s -> %s\n", thread_indent(1), probefunc())
printf ("\t %s args [%s]\n", probefunc(), $$parms)
}
@fourdollars
fourdollars / .abcde.conf
Last active October 4, 2018 00:32
sudo apt install abcde cd-discid lame cdparanoia id3 id3v2 eyed3
# System defaults for abcde version 2.8.1
# Nothing in this file is uncommented by default.
#
# If you wish to override these system-wide settings, create your own
# .abcde.conf file in your home directory.
# CDDB options
# Choose whether you want to use "cddb" and/or "musicbrainz". Default
# is "musicbrainz", but both can be specified in a comma delimited list
# to be tried sequentially in the event of failure of the first
function load_efi_video {
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
}
function load_video {
set gfxmode=auto
function load_efi_video {
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
}
function load_video {
set gfxmode=auto
class MachineBox extends React.Component {
render(){
return ( <div>Hello From React </div> );
}
}
let target = document.getElementById('machine-box');
ReactDOM.render(
<MachineBox />, target