Skip to content

Instantly share code, notes, and snippets.

View VincentSit's full-sized avatar

Vincent VincentSit

View GitHub Profile
@VincentSit
VincentSit / update_gfwlist.sh
Last active March 24, 2024 14:39
Automatically update the PAC for ShadowsocksX. Only tested on OS X. (Deprecated)
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@VincentSit
VincentSit / uninstall_wetype.sh
Created April 3, 2023 14:20
Uninstall WeType for macOS / 卸载 macOS 微信键盘
#!/bin/sh
INPUT_METHODS_DIR="/Library/Input Methods"
WETYPE_INSTALL_PATH="$INPUT_METHODS_DIR/WeType.app"
WXKB_INSTALL_PATH="$INPUT_METHODS_DIR/wxkbmac.app"
CUR_DIR=$(cd "$(dirname "$0")"; pwd)
echo "$(date +%H:%M:%S) kill WeType"
killall wxkbmac
#killall WeTypeFeedback
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <arpa/inet.h>
- (void)broadCast
{
int socketSD = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (socketSD <= 0) {
NSLog(@"Error: Could not open socket.");
@VincentSit
VincentSit / gist:a5ac735ca3d072b739c5ec5158900337
Created August 25, 2021 10:23
Generate PKG_CONFIG_PATH from HomeBrew
#!/bin/bash
for package in $(brew list)
do
# path=$(brew --cellar $package)
path="/usr/local/Cellar/$package"
# only the first match.
pkgdir=$(find $path -mindepth 1 -type d -name "pkgconfig" -print -quit 2> /dev/null)
@VincentSit
VincentSit / download_youku_playlist.py
Created August 17, 2018 19:37
Download youku video playlist. 批量下载优酷视频列表或保存列表视频链接.
#coding=utf-8
import os
import sys
import shlex
import requests
from bs4 import BeautifulSoup
# 前置
# 安装 you-get
@VincentSit
VincentSit / iOS @3x assets script
Created May 11, 2019 03:33 — forked from rnystrom/iOS @3x assets script
Save this shell script to generate @2x and 1x PNG assets for your apps. Requires Imagemagick (http://www.imagemagick.org/). These will probably look shitty and blurred.
#!/bin/sh
# Example usage
# cd into directory that has @3x images
# ./whatever-you-name-this.sh
# Remember to chmod +x the script
resize () {
ls *@3x.png | awk '{print("convert "$1" -filter box -resize '$1' "$1)}' | sed 's/@3x/'$2'/2' | /bin/sh
}
@VincentSit
VincentSit / CustomizedObjectTypeAdapter.kt
Last active February 23, 2021 00:24
Prevent GSON from converting integers to doubles in Kotlin
import com.google.gson.Gson
import com.google.gson.TypeAdapter
import com.google.gson.internal.LinkedTreeMap
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonToken
import com.google.gson.stream.JsonWriter
import java.io.IOException
import java.util.*
class CustomizedObjectTypeAdapter : TypeAdapter<Any>() {
@VincentSit
VincentSit / gist:39406d95514c72816975
Created December 9, 2015 10:24
download instagram image for specific user
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib import request
import json
import os
uid = 260732811
access_token = '277504095.59c578a.6aed864be0794247a1c0318221b03d7b'
base_url = r'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s' % (uid, access_token)
@VincentSit
VincentSit / Batch_ping_yunti_VPN_servers.sh
Last active January 21, 2021 13:29
批量 ping 云梯 VPN 服务器.
#!/bin/bash
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
# 批量 ping 云梯 VPN 服务器.
# 请将 example.com 替换为你的专属服务器地址.
HOSTS=("日本1号:jp1.example.com"
"日本2号:jp2.example.com"
"日本3号:jp3.example.com"