Skip to content

Instantly share code, notes, and snippets.

View BH1SCW's full-sized avatar

F.J Kong BH1SCW

View GitHub Profile
@snixon
snixon / mosh-agent-forwarding-ng.rb
Created October 16, 2015 19:23
Homebrew Formula: mosh with agent forwarding
require "formula"
class MobileShell < Formula
desc "Remote terminal application"
homepage "https://mosh.mit.edu/"
url "https://mosh.mit.edu/mosh-1.2.5.tar.gz"
sha256 "1af809e5d747c333a852fbf7acdbf4d354dc4bbc2839e3afe5cf798190074be3"
bottle do
sha256 "046b0c48cd1c573d57500e683122e3152a00556ad960938c6caa962b0c2ef460" => :el_capitan
@jrblevin
jrblevin / fantastical-capture.el
Created August 17, 2015 00:16
Sending Events to Fantastical 2 from Emacs <http://jblevins.org/log/emacs-fantastical>
;; To send events from Emacs to Fantastical using Control-C Control-F,
;; drop this script in your Emacs load path and add lines like these to
;; your .emacs:
;;
;; (autoload 'send-region-to-fantastical "fantastical-capture" "Send region to Fantastical" t)
;; (global-set-key (kbd "C-c C-f") 'send-region-to-fantastical)
;;
;; See http://jblevins.org/log/emacs-fantastical for details.
(defun applescript-quote-string (argument)
@ozuma
ozuma / centos7-minimal-rpm-qa.txt
Created September 11, 2014 07:43
Package Lists of CentOS 7 (minimal install)
ModemManager-glib-1.1.0-6.git20130913.el7.x86_64
NetworkManager-0.9.9.1-13.git20140326.4dba720.el7.x86_64
NetworkManager-glib-0.9.9.1-13.git20140326.4dba720.el7.x86_64
NetworkManager-tui-0.9.9.1-13.git20140326.4dba720.el7.x86_64
acl-2.2.51-12.el7.x86_64
aic94xx-firmware-30-6.el7.noarch
alsa-firmware-1.0.27-2.el7.noarch
alsa-lib-1.0.27.2-3.el7.x86_64
alsa-tools-firmware-1.0.27-4.el7.x86_64
audit-2.3.3-4.el7.x86_64
@shamil
shamil / mount_qcow2.md
Last active April 19, 2025 04:38
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@Cyan4973
Cyan4973 / gist:5b835641c134b8d6e7c3
Created June 19, 2014 21:55
Takayuki's Streaming example 2 (simplified)
// LZ4 streaming API example 2 (ring buffer)
#define _CRT_SECURE_NO_WARNINGS // for MSVC
#include "lz4.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@skiane
skiane / create-centos-6.5-mini-unattended-iso.sh
Last active March 14, 2023 23:48
# This script create a Centos Minimal Unattended ISO
# This script create a Centos Minimal Unattended ISO
# This method is based on excellent article http://pyxlmap.net/technology/software/linux/custom-centos-iso
#
# This script has be tested with CentOS 6.5
# TODO:
# * test package update to reduce the update task on the target system. The following command downloads all updates :
# (cd $CENTOS_CUSTOM_PATH/Packages ; yumdownloader $(for i in *; { echo ${i%%-[0-9]*}; } ) )
# Some global settings :
@ejdyksen
ejdyksen / patch-edid.md
Last active April 20, 2025 08:08
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@mchirico
mchirico / mmap.c
Last active February 28, 2023 05:29
An example of mmap where data is modified in the file. This version currently compiles on Mac OSX.
/*
An example of mmap where data is modified in the file. This
version currently compiles on Mac OSX.
References:
Advanced Programming in the UNIX® Environment, Third Edition
By: W. Richard Stevens; Stephen A. Rago
Publisher: Addison-Wesley Professional
@fxsjy
fxsjy / gist:2928683
Created June 14, 2012 07:22
bpnn solve kindergarten problem
# Back-Propagation Neural Networks
# another way: solve it as a Regression Problem
# Written in Python. See http://www.python.org/
# Modified by JSun to solve the problem here: http://www.weibo.com/1497035431/ynPEvC78V
# Neil Schemenauer <[email protected]>
import math
import random
import string
@masasdani
masasdani / mysql-backup-and-reset
Created March 9, 2012 06:33
mysql backup and reset
#mysql-backup
mysqldump -h localhost –u root –p myrootpassword db_name > db_test.sql
#for multiple database
mysqldump -h localhost –u root –p myrootpassword db_name1 db_name2 > db_test.sql
#for all table
mysqldump -h localhost –u root –p myrootpassword -all-databases > db_test.sql
#for specifiec table