Skip to content

Instantly share code, notes, and snippets.

View Winiex's full-sized avatar
🎯
Focusing

winiex Winiex

🎯
Focusing
View GitHub Profile
@Winiex
Winiex / windows-terminal-settings.json
Created May 21, 2020 06:54
Windows terminal settings.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"theme": "dark",
@Winiex
Winiex / backup.bash
Created June 9, 2016 08:29
Backup whole linux system using rsync
sudo rsync -apAXv --exclude=/dev/* --exclude=/proc/* \
--exclude=/sys/* --exclude=/tmp/* \
--exclude=/run/* --exclude=/mnt/* \
--exclude=/media/* --exclude=/lost+found \
--exclude=/backup / /backup
@Winiex
Winiex / download_itgonglun.sh
Last active March 8, 2018 05:48
批量下载 IT 公论播客音频,节目爱好者收藏或备份用。需要安装 axel。
BASE_URL="http://ipn.li/itgonglun/"
POSTFILE="/audio.mp3"
for i in $(eval echo {$1..$2})
do
URL=$BASE_URL$i$POSTFILE
FILENAME=$i".mp3"
echo "Now download "$URL
axel -n 10 -o $FILENAME $URL
done
@Winiex
Winiex / git-igtnore-io.sh
Last active August 29, 2015 14:07
自动获取适合于相关语言、IDE 环境的 .gitignore 的脚本。基于 https://www.gitignore.io/
function git-ignore-io() {
curl https://www.gitignore.io/api/$@ ;
}
@Winiex
Winiex / backup_xiami_songs.py
Last active August 29, 2015 14:07
用于备份虾米音乐收藏乐库的脚本。Quick and dirty,but it works。依赖 keyring、requests、pycrypto、beautifulsoup4,运行于 python2.7。暂时只支持 Mac OS X。它会读取 Chrome 浏览器对于 xiami 域名的加密 cookie(所以你必须使用 Chrome 浏览器登录过虾米),解密后形成 cookies,进而使用 requests 请求虾米的页面,使用 beautifulsoup4 提取歌曲信息,最终 dump 成一份包含歌曲信息的 sqlite3 数据库文件。
#!/usr/bin/env python
# -*- coding:utf8 -*-
import time
import argparse
import os
import requests
import sqlite3
import keyring
from Crypto.Cipher import AES
@Winiex
Winiex / build_and_analyze.sh
Last active December 26, 2015 05:09
Some podcast download scripts.
#/usr/bin/env bash
#Origin http://5by5.tv/buildanalyze/
BASEURL=http://d.5by5.net/redirect.mp3/fly.5by5.tv/audio/broadcasts/buildanalyze/
PREFIX=/buildanalyze-
MP3=.mp3
for i in $(seq 1 1 108)
do
if [ $i -lt 7 ]
then
@Winiex
Winiex / infix-to-postfix-regexp.js
Created October 30, 2012 01:30 — forked from DmitrySoshnikov/infix-to-postfix-regexp.js
JavaScript : Infix to postfix notation RegExp converter
/**
* Infix to postfix notation RegExp converter
*
* To implement RegExp machine (NFA, DFA) we need
* to transform first RegExp string to postfix notation
* for more convinient work with the stack. This function
* does exactly this.
*
* See: http://swtch.com/~rsc/regexp/regexp1.html
*
@Winiex
Winiex / SquareGridLayout.java
Created October 4, 2012 14:00 — forked from tomgibara/SquareGridLayout.java
Square grid layout for Android
package com.tomgibara.android.util;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
* A layout that arranges views into a grid of same-sized squares.
@Winiex
Winiex / DashboardLayout.java
Created September 30, 2012 19:40 — forked from romannurik/DashboardLayout.java
Android - DashboardLayout
/*
* ATTENTION:
*
* This layout is now maintained in the `iosched' code.google.com project:
*
* http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
*
*/
/*
@Winiex
Winiex / quick.c
Created August 17, 2012 13:09 — forked from rohit-nsit08/quick.c
C: Quick Sort
//quick sort
#include<stdio.h>
void quicksort(int*arr,int left, int right);
int partition(int *arr,int left,int right);
int main()
{
int arr[6]={5,4,1,2,8,3};
int i;