This file contains hidden or 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
| #!/system_ext/bin/bash | |
| pwd=$(dirname $0) | |
| cd ${pwd} 2> /dev/null | |
| # toggle_mount.sh: Toggles specified Device Mapper device(s) between read-only (ro) and read-write (rw) on Pixel 7a (LineageOS) | |
| # Usage: | |
| # Single device: toggle_mount <device> <ro|rw> (e.g., toggle_mount system_a rw) | |
| # All system/product/vendor: toggle_mount --all rw | |
| # Features: Compares dmctl table before/after; avoids lsblk; converts multiple devices to rw |
This file contains hidden or 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 enum import Enum, auto | |
| import os | |
| def list_directories_recursively(path): | |
| for root2, dirs, files in os.walk(path): | |
| root = root2 + "/" | |
| root = root2[len(path) + 1 :] | |
| # 現在のディレクトリ内のサブディレクトリをリストアップ | |
| for file in files: |
This file contains hidden or 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
| #include <ios> | |
| #include <iostream> | |
| #include <iomanip> | |
| #include <limits> | |
| template <typename _NumberT> | |
| class ValidNumberFmt | |
| { | |
| _NumberT n; |
This file contains hidden or 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 sys | |
| from zipfile import ZipFile | |
| from lxml import etree | |
| import datetime | |
| def loopxml(zr:ZipFile, name:str): | |
| parser = etree.XMLPullParser(['start', 'end']) | |
| level = 0 | |
| stack = [] | |
| with zr.open(zr.getinfo(name)) as reader: | |
| while True: |
This file contains hidden or 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
| #cloud-config | |
| mounts: | |
| - [ /dev/mapper/VG_SDB-pv, /mnt/pv, xfs, rw, "0", "1" ] | |
| - [ /dev/mapper/VG_SDB-swap, none, swap, sw, "0", "0" ] | |
| runcmd: | |
| - apt-get update | |
| - apt-get install -y vim less bash-completion | |
| - pvcreate /dev/sdb | |
| - vgcreate VG_SDB /dev/sdb | |
| - lvcreate -L 5G -n swap VG_SDB |
This file contains hidden or 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/bash | |
| BACKUP_LAST=backup_last | |
| BACKUP_CUR=backup_cur | |
| BACKUP_SNAP=backup.sql.gz | |
| BINLOG=binlog-$(date +%Y%m%d-%H%M%S-%N).sql.gz | |
| BINLOGS=binlogs.txt | |
| CONNECT_OPT=" -u root -h docker-db-pc -pexample " | |
| get_binlog_list() { | |
| echo "show binary logs;" | mysql ${CONNECT_OPT} | cut -f 1 | tail -n +2 |
This file contains hidden or 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
| #include<stdio.h> | |
| #include<fcntl.h> | |
| #include<unistd.h> | |
| #include<stdlib.h> | |
| #include<string.h> | |
| void s2p(const char *path) { | |
| char buf[2]; | |
| int fd = open(path, O_WRONLY); | |
| while(fread(buf, 1, 1, stdin)) { | |
| int cnt=1; |
This file contains hidden or 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
| s/\r$//; | |
| /^--------$/{ | |
| d; | |
| } | |
| /^-----$/!{ | |
| H; | |
| /^BODY:/,/^COMMENT:/{ | |
| /^COMMENT:/{ |
This file contains hidden or 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
| DROP table testtbl | |
| ; | |
| CREATE table | |
| testtbl (id int, | |
| dat datetime, | |
| valuenum int, | |
| valuenum2 int, | |
| value varchar(30), | |
| primary key(id, | |
| dat)) |
This file contains hidden or 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
| package postgres | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| "time" | |
| _ "github.com/lib/pq" | |
| ) |