Skip to content

Instantly share code, notes, and snippets.

View lbj96347's full-sized avatar

lbjhk lbj96347

View GitHub Profile
@lbj96347
lbj96347 / slack_deletron_batch_delete.js
Last active July 17, 2018 02:59
Slack Deletron Batch Delete
var i = 0;
var job = self.setInterval("deleteFile()", 1000);
function deleteFile() {
i = i + 1;
if ( i == 90 ){
job = window.clearInterval(job)
}else{
try
{
//在这里运行代码
@lbj96347
lbj96347 / rename.sh
Created January 19, 2018 02:35
This bash script can allow you to manage your aerial photos in one mission more easier.
#!/bin/bash
a=1 #a is for the first number
for i in *.JPG; do #Replace JPG, then you can edit your file extension
new=$(printf "%04d.JPG" "$a") #04 pad to length of 4
mv -i -- "$i" "$new"
let a=a+1
done
@lbj96347
lbj96347 / fast_install_ss.sh
Last active January 19, 2018 02:30
It's a quick installation bash for installing ssserver. Your machine should be CentOS 7.0. Paste this file to your machine and use `sh fast_install_ss.sh`. Everything is done.
#!/bin/bash
yum install python-setuptools && easy_install pip && git
pip install git+https://github.com/shadowsocks/shadowsocks.git@master
echo '{ "server":"0.0.0.0", "server_port":8388, "password":"cashisking", "timeout":300, "method":"aes-256-cfb", "fast_open": false}' | tee /etc/shadowsocks.json
ssserver -c /etc/shadowsocks.json
@lbj96347
lbj96347 / GetIPAddressCellularNetwork.m
Created May 14, 2016 08:51
iOS/tvOS get IP Address from current network ( via Cellular network )
#import <ifaddrs.h>
#import <arpa/inet.h>
#import <net/if.h>
#define IOS_CELLULAR @"pdp_ip0"
#define IOS_WIFI @"en0"
#define IOS_VPN @"utun0"
#define IP_ADDR_IPv4 @"ipv4"
#define IP_ADDR_IPv6 @"ipv6"
@lbj96347
lbj96347 / GetIPAddress.m
Created May 14, 2016 08:48
iOS Get IP Address in app.( via Wifi )
#import <ifaddrs.h>
#import <arpa/inet.h>
// Get IP Address
- (NSString *)getIPAddress {
NSString *address = @"error";
struct ifaddrs *interfaces = NULL;
@lbj96347
lbj96347 / gfwlist.js
Created March 31, 2016 09:32
gfwlist for shadowsocks config.
// Generated by CashLee
var domains = {
"cloudfront.net":1,
"w.org":1,
"ghost.io":1,
"mozilla.org":1,
"docker.io":1,
"kitematic.com":1,
"docker.com":1,
@lbj96347
lbj96347 / get-parameter-demo
Last active August 29, 2015 14:20
javascript-get-url-parameter
function getParameter( name, url ) {
if (!url) url = location.href
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
}
getParameter('q', 'hxxp://example.com/?q=abc');
@lbj96347
lbj96347 / ios-png-rename.sh
Created December 16, 2013 04:49
重命名iOS切图,命令行。这个是将*@2x.png全部转换成*.png的
for F in *.png ;
do cp $F ${F%@2x.png}.png;
done
@lbj96347
lbj96347 / auto-git-bare-init.sh
Created December 2, 2013 06:09
auto-git-bare-init
#!/bin/sh
if [ ! -n "$1" ]
then
echo "error!! repository is none"
else
mkdir $1
echo "build a new repository : $1"
cd $1 && git --bare init && chown -vR git objects refs/heads
echo "complete"
fi
@lbj96347
lbj96347 / sina-mid-convert.php
Created September 17, 2013 15:57
新浪微博消息ID-MID转换算法
<?php
function sinaWburl2ID($url) {
$surl[2] = str62to10(substr($url, strlen($url) - 4, 4));
$surl[1] = str62to10(substr($url, strlen($url) - 8, 4));
$surl[0] = str62to10(substr($url, 0, strlen($url) - 8));
$int10 = $surl[0] . $surl[1] . $surl[2];
return ltrim($int10, '0');
}