This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Disclaimer: | |
# This is a simple script to run qemu arm64 system simulation on x86 host with | |
# prebuilt image. Tested on QEMU emulator version 6.2.0 on Ubuntu22.04 LTS host. | |
# | |
# Directory layout: | |
# qemu_ubuntu2204_arm64; | |
# ├── cloud-config.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Disclaimer: | |
# This is a simple script to run gem5 full system simulation. | |
# Tested on gem5 version 23.1.0.0. | |
# Quickstart and compile gem5: https://www.gem5.org/getting_started/ | |
# prebuilt kernel image: http://dist.gem5.org/dist/v22-0/arm/aarch-system-20220707.tar.bz2 | |
# prebuilt rootfs: http://dist.gem5.org/dist/current/arm/disks/linaro-minimal-aarch64.img.bz2 | |
# Author of this script: yiidtw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doPost(e) { | |
var CHANNEL_ACCESS_TOKEN = '<your channel access token>'; | |
var msg= JSON.parse(e.postData.contents); | |
console.log(msg); | |
var replyToken = msg.events[0].replyToken; | |
var userMessage = msg.events[0].message.text; | |
if (typeof replyToken === 'undefined') { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
################################################################################ | |
# python environment control | |
################################################################################ | |
export PYTHON_ENV="" | |
function entervirtualenv | |
{ | |
if type virtualenvwrapper.sh >/dev/null 2>&1; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
################################################################################ | |
# python environment control | |
################################################################################ | |
export PYTHON_ENV="" | |
function entervirtualenv | |
{ | |
if type virtualenvwrapper.sh >/dev/null 2>&1; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
<style> | |
.done { | |
text-decoration: line-through | |
} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import dateutil.parser # pip install python-dateutil | |
s = '2019-05-15T01:23:54Z' | |
d = dateutil.parser.parse(s) | |
t = d.replace(tzinfo=datetime.timezone.utc).timestamp() | |
# s = '2019-05-15T01:23:54Z' | |
# d = datetime.datetime(2019, 5, 15, 1, 23, 54, tzinfo=tzutc()) | |
# t = 1557883434.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg_dump -h db_host -U user_name -p 5432 -F c -v -f /path/to/backup/data.bak db_name | |
pg_restore -v -h db_host -p 5432 -U user_name -d db_name /path/to/backup/data.bak | |
curl -X GET 'http://localhost:9200/_cat/indices?v' | |
# dump | |
elasticdump --input=http://localhost:9200/index_name --output=/path/to/backup/data.json --type=data | |
# restore | |
elasticdump --input=/tmp/aa.aisoc/ds_as.json --output=http://localhost:9200 --type=data --headers='{"content-type": "application/json"}' |
NewerOlder