Skip to content

Instantly share code, notes, and snippets.

View BH1SCW's full-sized avatar

F.J Kong BH1SCW

View GitHub Profile
@xuhdev
xuhdev / ctags_with_dep.sh
Last active June 13, 2024 15:47
Generate ctags file for C or C++ files and its depedencies (included header files). This could avoid you to always generate a huge tags file.
#!/bin/sh
# https://www.topbug.net/blog/2012/03/17/generate-ctags-files-for-c-slash-c-plus-plus-source-files-and-all-of-their-included-header-files/
# ./ctags_with_dep.sh file1.c file2.c ... to generate a tags file for these files.
gcc -M "$@" | sed -e 's/[\\ ]/\n/g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | \
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
@iegik
iegik / nautilus2thunar.sh
Created February 16, 2012 22:37
Switch from Nautilus to Thunar file manager
#!/bin/bash
## Originally written by aysiu from the Ubuntu Forums
## This is GPL'ed code
## So improve it and re-release it
## Define portion to make Thunar the default if that appears to be the appropriate action
makethunardefault()
{
## I went with --no-install-recommends because
@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
@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
@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
@ejdyksen
ejdyksen / patch-edid.md
Last active October 31, 2024 20:52
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):

@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 :
@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>
@shamil
shamil / mount_qcow2.md
Last active November 16, 2024 09:15
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
@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