Skip to content

Instantly share code, notes, and snippets.

@alswl
alswl / hosts
Last active November 12, 2023 11:17
(deprecated, I bought xiaomi VIP)hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
@aubricus
aubricus / License
Last active June 20, 2023 01:19
Python Progress Bar
Copyright 2020 Aubrey Taylor
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 substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH
@jaymzznoori
jaymzznoori / Example.qml
Last active November 27, 2016 21:59
Example for Sailfish UI programming in QML
import QtQuick 2.0
import Sailfish.Silica 1.0
ApplicationWindow {
// Chapter 1: Basic primitives
Image {
visible: false
source: "jolla.png"
Behavior on opacity { NumberAnimation {} }
@stephanetimmermans
stephanetimmermans / intall-wordpress-debian.sh
Created September 22, 2015 19:16
Install Wordpress on Debian
#http://www.linuxserve.com/2015/05/install-latest-wordpress-version-on.html
su -
apt-get install apache2 mysql-client mysql-server php5 php5-mysql php5-curl php5-gd
mysql -u root -p
CREATE DATABASE wpdatabase;
CREATE USER wpuser@localhost IDENTIFIED BY 'wppass';
GRANT ALL PRIVILEGES ON wpdatabase.* TO wpuser@localhost;
FLUSH PRIVILEGES;
exit
@tjefferson
tjefferson / browser-detection.js
Last active April 27, 2022 06:13
get more precise Chinese browser information in google analytics
<script>
var browserName = "Other";
var ua = window.navigator.userAgent;
browserRegExp = {
Sogou : /SE\s2\.X|SogouMobileBrowser/,
Explorer2345 : /2345Explorer|2345chrome|Mb2345Browser/,
Liebao : /LBBROWSER/,
Wechat : /MicroMessenger/,
QQBrowser : /QQBrowser/,
Baidu : /BIDUBrowser|baidubrowser|BaiduHD/,
@javiermon
javiermon / instructions.txt
Last active November 15, 2016 00:38
sdcard4jolla
[nemo@Jolla ~]$ devel-su
Password:
[root@Jolla nemo]# cd /etc/systemd/system
[root@Jolla system]# nano mount-sd4android.service
[root@Jolla system]#
[root@Jolla system]# nano /usr/local/sbin/mount-sd4android.sh
[root@Jolla system]# chmod ug+x /usr/local/sbin/mount-sd4android.sh
[root@Jolla system]# systemctl enable mount-sd4android.service
ln -s '/etc/systemd/system/mount-sd4android.service' '/etc/systemd/system/graphical.target.wants/mount-sd4android.service'
ln -s '/etc/systemd/system/mount-sd4android.service' '/etc/systemd/system/display.service.wants/mount-sd4android.service'
@tarruda
tarruda / gtk3-pyenv.sh
Created January 9, 2015 06:38
Install pygtk3 in pyenv
#!/bin/bash
# script for pyenv installation of pygtk3 in ubuntu 12.04
# Adapted from https://gist.github.com/mehcode/6172694
system_package_installed() {
if ! dpkg -l | grep -q $1; then
sudo apt-get install $1
fi
}
@rje
rje / SelectPrefabsOfType.cs
Last active February 28, 2023 23:47
Small unity utility to find all prefab objects that have a given component on them
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Reflection;
public class SelectPrefabsOfType : EditorWindow {
[MenuItem("Window/Prefab Finder")]
@cuth
cuth / debug-scroll.md
Last active February 7, 2024 18:17
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right &gt; w || b.left &lt; 0) {
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update