Skip to content

Instantly share code, notes, and snippets.

@tienhv
tienhv / dropbox unreponsive icon.txt
Created February 24, 2016 21:13
dropbox icon not working, unresponsive
http://askubuntu.com/questions/732967/dropbox-icon-is-not-working-xubuntu-14-04-lts-64
Just insert:
os.environ['DBUS_SESSION_BUS_ADDRESS'] = ""
into /usr/bin/dropbox
at the beginning, after
@tienhv
tienhv / fixt-curl.txt
Created February 18, 2016 16:02
Fix certificate error with curl
#http://stackoverflow.com/questions/3160909/how-do-i-deal-with-certificates-using-curl-while-trying-to-access-an-https-url
curl: (77) error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
The issue was that curl expected the certificate to be at the path /etc/pki/tls/certs/ca-bundle.crt but could not find it because it was at the path /etc/ssl/certs/ca-certificates.crt.
Copying my certificate to the expected destination by running
sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
@tienhv
tienhv / tes.py
Created January 28, 2016 14:56
selenium scrolling
# https://seleniumwithjavapython.wordpress.com/selenium-with-python/intermediate-topics/scrolling-down-a-page/
import unittest
from selenium import webdriver
class fblogin(unittest.TestCase):
def setUp(self):
self.driver=webdriver.Firefox()
self.driver.get("http://www.facebook.com")
self.driver.maximize_window()
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=logo-concepts.pdf logo-concepts-1.pdf logo-concepts-2.pdf logo-concepts-3.pdf
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
http://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot
@tienhv
tienhv / remove doc
Created October 6, 2015 21:47
latex
dpkg -l | grep '^ii.*texlive.*doc'
apt-get remove --purge \
texlive-fonts-recommended-doc texlive-latex-base-doc texlive-latex-extra-doc \
texlive-latex-recommended-doc texlive-pictures-doc texlive-pstricks-doc
I found three possibilities:
1. Date and Time Indicator in the Indicator Plugin of the panel
1. Install indicator-datetime from the Software Center or in the terminal sudo apt-get install indicator-datetime (it will install several other packages)
2. Add the Indicator Plugin to the Panel (right-click on the panel and choose add new items) if not done before
3. Right-click in the Indicator Plugin and choose Properties and hide “Keyboard” if necessary and wished
4. I could not open the "Date & Time Settings" from the drop-down menu of the indicator. But you can set the timezones with the dconf-editor: Install the dconf-editor (Software Center or sudo apt-get install dconf-editor)
Dconf-editor: Select com > canonical > indicator > datetime
Look at the locations field as shown in the first answer of this question and add your new location(s) - each entry is in the format ,'timezone city' i.e. separate entries with commas Look at the locations value.
['UTC UTC', 'Asia/Nicosia Nicosia']
You can find the list of tim
"fluxgui is already running, exiting:"
fix:
rm /tmp/fluxgui_**.pid
kill it again
done
ref:
http://soledadpenades.com/2011/08/01/fix-the-fluxgui-is-already-running-exiting-error/
import pandas as pd
import numpy as np
ser = pd.Series(np.random.normal(size=1000))
cum_dist = np.linspace(0.,1.,len(ser))
ser_cdf = pd.Series(cum_dist, index=ser.order())
ser_cdf.plot()
plt.show()
#http://stackoverflow.com/questions/25577352/plotting-cdf-of-a-pandas-series-in-python
import sys
import pandas as pd
import matplotlib.pyplot as plt
def plot_pdf(pdf):
plot(pdf,'pdf')
def plot_cdf(pdf):
s = pdf.sum()
plot(pdf.cumsum(0)/s, 'cdf')
def plot_ccdf(pdf):