Skip to content

Instantly share code, notes, and snippets.

View cobaohieu's full-sized avatar

Hieu C B cobaohieu

View GitHub Profile
@keithweaver
keithweaver / split-video-by-frame.py
Created May 10, 2017 19:30
Using OpenCV takes a mp4 video and produces a number of images.
'''
Using OpenCV takes a mp4 video and produces a number of images.
Requirements
----
You require OpenCV 3.2 to be installed.
Run
----
Open the main.py and edit the path to the video. Then run:
sudo apt-get update
sudo apt-get install bcmwl-kernel-source
sudo modprobe wl
Opensuse:
Add repo:
zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_42.2/ packman
@wavezhang
wavezhang / java_download.sh
Last active May 16, 2026 11:09
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@rafael-neri
rafael-neri / makedeb.sh
Last active June 7, 2025 08:25
Simple script to create debian package
#!/bin/bash
# Distributed under the GNU GPL
# Check if user is root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Get path
anonymous
anonymous / basicWindow.py
Created May 20, 2016 19:26
import sys
from PyQt5 import QtWidgets
def window():
app = QtWidgets.QApplication(sys.argv)
w = QtWidgets.QWidget()
w.setWindowTitle('PYQt5 lesson 1')
w.show()
sys.exit(app.exec_())
@wafsek
wafsek / whiptailmenu.bash
Last active December 13, 2024 16:04
A Example of whiptail menu with functions
#! /bin/bash
# This program is just an example of how to make a whiptail menu and some basic commands.
# Copyright (C) 2016 Baljit Singh Sarai
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License.
#!/bin/sh -x ## or just ` curl -Ls http://git.io/vRozn | sh `.
## Downloads the Mac OS X 10.10 Recovery Partition update,
## Copy's over the 10.10 version of Disk Utility.app, then
## use git to apply a binary patch so it will run on 10.11+.
cd /tmp
rm -rf DU1010
mkdir DU1010
@astronom
astronom / roundListTo100.js
Created September 28, 2015 14:05
How to make rounded percentages add up to 100%
// from http://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100
function foo(l, target) {
var off = target - _.reduce(l, function(acc, x) { return acc + Math.round(x) }, 0);
return _.chain(l).
sortBy(function(x) { return Math.round(x) - x }).
map(function(x, i) { return Math.round(x) + (off > i) - (i >= (l.length + off)) }).
value();
}
@jamesattard
jamesattard / gist:51240a9a60ca6bf9513e
Last active October 19, 2025 18:40
Fix Permissions and Refresh KExt cache
echo "Fixing ownership and permissions..."
chmod -R 755 /System/Library/Extensions/*
chown -R root:wheel /System/Library/Extensions/*
chown root:admin /
echo "Rebuilding kext cache..."
kextcache -system-prelinked-kernel
kextcache -system-caches
@harish-r
harish-r / Binary Search Tree.cpp
Last active October 13, 2025 21:23
Binary Search Tree Implementation in C++
/*
** Binary Search Tree implementation in C++
** Harish R
*/
#include<iostream>
using namespace std;
class BST {
struct node {