Skip to content

Instantly share code, notes, and snippets.

@tienhv
tienhv / clean-docker-for-mac.sh
Created May 3, 2017 09:20 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# Installing Chrome
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
hdiutil mount -nobrowse googlechrome.dmg
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications
hdiutil unmount "/Volumes/Google Chrome"
rm googlechrome.dmg
# Installing Firefox
curl -L -o Firefox.dmg "http://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
hdiutil mount -nobrowse Firefox.dmg
@tienhv
tienhv / test.py
Created July 10, 2016 08:48
testing_gist_creating
from matplotlib import pyplot
import numpy as np
pyplot.plot([1,3,642,34])
pyplot.show()
@tienhv
tienhv / atom
Last active June 24, 2016 13:31
atom sync
a
write a note:\
how install caravel on windows
how to see colorlogs on windows
@tienhv
tienhv / concat.txt
Created April 6, 2016 15:35
concat files and remove duplicate at the same time
First off, you're not using the full power of cat. The loop can be replaced by just
http://stackoverflow.com/questions/16873669/combine-multiple-text-files-and-remove-duplicates
cat data/* > dnsFull
assuming that file is initially empty.
Then there's all those temporary files that force programs to wait for hard disks (commonly the slowest parts in modern computer systems). Use a pipeline:
cat data/* | sort | uniq > dnsOut
This is still wasteful since sort alone can do what you're using cat and uniq for; the whole script can be replaced by
Dear,
I found one critical problem from your first time setting up new Lumia 925 Phone. This error is like this: cannot restore a phone backup from microsoft cloud if you are alone and having only that phone. Here are how they are:
1. Reset Phone to factory setting by Setting ->Abbout-->reset phone
2. Following instructions, including connected to wifi and enter user name, password for microsoft account
3. Okay, this is the fun part: There are options to restore backups or set up a new phone. I choose restore backup.
4. The phone asks me for verification by my phone number (enter last 4 digit of that number) or using the email (enter the email)
5. I choose the 1st option: use my phone number to recieve the security code.
6. I wait for 30 minutes, nothing happens, try again, the same. I figured out that if the phone is not completedly finishing setting up. It cannot receive the SMS
@tienhv
tienhv / git_folder
Created March 18, 2016 15:33
put the git folder out of source folder
#http://stackoverflow.com/questions/17913550/git-moving-the-git-directory-to-another-drive-keep-the-source-code-where-it
gitdir:
Or you can replace the .git folder with a file that tells git where the .git folder really is. This is exactly how git submodules are setup by default in version 1.7.8 or later.
The steps to re-configure an existing checkout are:
move the .git dir to where it needs to be
replace it with a file .git containing: gitdir: path/to/.git
define core.worktree to point at the working copy
As a script that would be:
@tienhv
tienhv / gist:cd377e8de5a286e5de97
Created March 14, 2016 15:51
remove watermark / text from pdf
src:http://superuser.com/questions/448519/how-to-remove-watermark-from-pdf-using-pdftk
very simply task to perform:
use sed:
sed -e "s/watermarktextstring/ /g" <input.pdf >unwatermarked.pdf
but, after, be sure to repair resulting output pdf
pdftk unwatermarked.pdf output fixed.pdf && mv fixed.pdf unwatermarked.pdf
all into one command:
@tienhv
tienhv / gist:2752e9e19cabf4fb5f30
Created March 2, 2016 16:26 — forked from miohtama/gist:5158737
Colorful Python logger
# -*- coding: utf-8 -*-
"""
Python logging tuned to extreme.
"""
__author__ = "Mikko Ohtamaa <mikko@opensourcehacker.com>"
__license__ = "MIT"